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

Flags.java uses String.toLowerCase without specifying Locale

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 8
    • 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();
            }
        }
        ---

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

                Created:
                Updated:
                Resolved: