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

Apt causes NullPointerException running on a Simplified Chinese test case

XMLWordPrintable

    • apt
    • other
    • windows_xp

        OPERATING SYSTEM(S):
        Windows (simplified Chinese)
        FULL JDK VERSION(S):
        java version "1.5.0_01"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)
        Java HotSpot(TM) Client VM (build 1.5.0_01-b08, mixed mode, sharing)
        Also:
        java version "1.5.0_04"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
        Java HotSpot(TM) Client VM (build 1.5.0_04-b05, mixed mode)
        DESCRIPTION:
        Apt causes a NullPointerException running on a simplified Chinese testcase. This fails with 1.5.0_01 onwards, but not with 1.5.0 GA. It looks like the regression is caused by 6174696.
        The NPE is caused by the Log class dereferencing a null source file name. However there is also the issue of the original lexError in Parser.ident()
        - Exact steps to reproduce
        Extract sunbug.jar and run setup.bat
        - Minimal source code that demonstrates the problem
        Source is included in sunbug.jar
        - Expected output
        C:\data\dev\92452\temp>java -version
        java version "1.5.0"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
        Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode)
        C:\data\dev\92452\temp>setup.bat
        compiling
        1 file(s) copied.
        invoking MetaTest
        method annotation(String): ??????????_1, value: ??????????_1
        method annotation(String): ??????????_2, value: ??????????_2
        method annotation(String): ??????????_3, value: ??????????_3
        field annotation(String): ??????????_1, value: ??????????_1
        field annotation(String): ??????????_2, value: ??????????_2
        class annotation: ??????????_1(int): 1234567890, ??????????_2(String): ??????????
        Press any key to continue . . .
        apt tool test
        class: MetaTest
        method: main
        method: runTest
        class: MetaTest.AnnotatedTest
        annotation: ??????????
        method: ??????????_2
        value: "??????????"
        method: ??????????_1
        value: 1234567890
        method: ??????????_3
        annotation: ??????????_method
        method: value
        value: "??????????_3"
        method: ??????????_2
        annotation: ??????????_method
        method: value
        value: "??????????_2"
        method: ??????????_1
        annotation: ??????????_method
        method: value
        value: "??????????_1"
        - Actual output
        C:\data\dev\92452\temp>java -version
        java version "1.5.0_01"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)
        Java HotSpot(TM) Client VM (build 1.5.0_01-b08, mixed mode, sharing)
        C:\data\dev\92452\temp>setup.bat
        compiling
        1 file(s) copied.
        invoking MetaTest
        method annotation(String): ??????????_1, value: ??????????_1
        method annotation(String): ??????????_2, value: ??????????_2
        method annotation(String): ??????????_3, value: ??????????_3
        field annotation(String): ??????????_1, value: ??????????_1
        field annotation(String): ??????????_2, value: ??????????_2
        class annotation: ??????????_1(int): 1234567890, ??????????_2(String): ??????????
        Press any key to continue . . .
        apt tool test
        null:2: illegal character: \30
        An exception has occurred in apt (1.5.0_01). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) after checking the Bug
        Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
        java.lang.NullPointerException
        at com.sun.tools.javac.util.Log.printErrLine(Log.java:198)
        at com.sun.tools.javac.util.Log.printDiagnostic(Log.java:262)
        at com.sun.tools.javac.util.Log.error(Log.java:281)
        at com.sun.tools.javac.parser.Scanner.lexError(Scanner.java:426)
        at com.sun.tools.javac.parser.Scanner.lexError(Scanner.java:447)
        at com.sun.tools.javac.parser.Scanner.nextToken(Scanner.java:1333)
        at com.sun.tools.javac.parser.Parser.ident(Parser.java:334)
        at com.sun.tools.javac.parser.Parser.qualident(Parser.java:372)
        at com.sun.tools.javac.main.JavaCompiler.resolveIdent(JavaCompiler.java:315)
        at com.sun.tools.apt.mirror.declaration.DeclarationMaker.nameToSymbol(DeclarationMaker.java:140)
        at com.sun.tools.apt.mirror.declaration.DeclarationMaker.getTypeDeclaration(DeclarationMaker.java:125)
        at com.sun.tools.apt.comp.Apt.main(Apt.java:363)
        at com.sun.tools.apt.main.JavaCompiler.compile(JavaCompiler.java:458)
        at com.sun.tools.apt.main.Main.compile(Main.java:1075)
        at com.sun.tools.apt.main.Main.compile(Main.java:938)
        at com.sun.tools.apt.Main.processing(Main.java:95)
        at com.sun.tools.apt.Main.process(Main.java:43)
        at com.sun.tools.apt.Main.main(Main.java:34)
        - Any additional configuration information
        The system must be set up to use a simplified Chinese locale
        An updated description has been uploaded to the "Comments" section.

              npatelsunw Nishant Patel (Inactive)
              elarsen Erik Larsen (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: