Flags.java uses String.toLowerCase without specifying Locale

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 9
    • Affects Version/s: 8
    • Component/s: tools
    • b01
    • Verified

        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();
            }
        }
        ---

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

                Created:
                Updated:
                Resolved: