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

Some ASCII characters are not treated correctly in identifiers

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not an Issue
    • P3
    • None
    • 8
    • tools
    • windows_7

    Description

      FULL PRODUCT VERSION :
      java version "1.8.0-ea"
      Java(TM) SE Runtime Environment (build 1.8.0-ea-b105)
      Java HotSpot(TM) 64-Bit Server VM (build 25.0-b47, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      It appears that compiler ignores all ASCII symbols that are not letters, digits, dollar sign and underscore in identifiers. That causes two different class members (e.g. 'm' and 'm\u0080') to be treated as having the same name thus making compiler failing with error 'variable is already defined'.

      Along with '\u0080', other symbols cause the same error, e.g. '\u00cf', '\u00e9'. It appears that any ASCII symbol (with code from 0 to 0xFF) that is not valid letter, digit, dollar sign or underscore is treated this way.

      As a consequence variables with name '\u00cf' and '\u00e' are treated as having duplicate names.

      REGRESSION. Last worked in version 7u25

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Try to compile 'Main.java' with the following code:

      ------

      public class Test {
      int m;
          int m\u0080;
      }

      ------

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Compiler should not fail. Java 7 compiler processes this file without errors
      ACTUAL -
      Test.java:3: error: variable m is already defined in class Test
          int m\u0080;

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class Test {
      int m;
          int m\u0080;
      }
      ---------- END SOURCE ----------

      Attachments

        Issue Links

          Activity

            People

              jjg Jonathan Gibbons
              rcalnan Roger Calnan
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: