Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8029800

Flags.java uses String.toLowerCase without specifying Locale

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 8
    • Fix Version/s: 9
    • Component/s: tools
    • Subcomponent:
    • Resolved In Build:
      b01
    • Verification:
      Verified

      Backports

        Description

        The constructor of com.sun.tools.javac.code.Flags.Flag uses toLowerCase without specifying locale, which may lead to problems when Flag.PUBLIC is converted to lower case on (e.g.) Turkish locale and then used.

        This leads to the following problem. Consider this source code:
        ---
        public class LocaleTest { }
        ---

        Run javac as:
        ---
        $ javac -J-Duser.region=TR -J-Duser.language=tr -printsource -d target LocaleTest.java
        ---

        The outcome will be:
        ---
        publ\u0131c class LocaleTest {
            
            publ\u0131c LocaleTest() {
                super();
            }
        }
        ---

        Which is unexpected, expected is:
        ---
        public class LocaleTest {
            
            public LocaleTest() {
                super();
            }
        }
        ---

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                jlahoda Jan Lahoda
                Reporter:
                jlahoda Jan Lahoda
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: