Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6308351
Votes 0
Synopsis Apt causes NullPointerException running on a Simplified Chinese test case
Category java:apt
Reported Against b05
Release Fixed , mustang(b85) (Bug ID:2137441)
State 5-Cause Known, bug
Priority: 4-Low
Related Bugs 6416679
Submit Date 09-AUG-2005
Description
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
Posted Date : 2005-08-09 16:10:46.0

An updated description has been uploaded to the "Comments" section.
Posted Date : 2005-10-12 18:37:21.0
Work Around
N/A
Evaluation
The files discussed in the description are not attached to this bug.  Please attach the files in question; marking the bug incomplete.
Posted Date : 2005-08-12 04:56:53.0

With the additional files, the internal NullPointerException has been reproduced.  The discovery loop appears fails for some reason if the annotations on the declarations are declared private.  Will investigate further.
Posted Date : 2005-10-26 02:19:15.0

There are actually two bugs here:

* resolveIdent uses StringBufferInputStream which was fixed in
  Mustang as part of the work for JSR 199 see bug 6224925.

* Fix com.sun.tools.apt.mirror.declaration.DeclarationMaker.getTypeDeclaration,
  it shouldn't use resolveIdent to resolve classes which might be private.
  Using ClassReader.enterClass seems more appropriate for this purpose.
Posted Date : 2005-10-31 21:26:37.0
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang