RFR: JDK-8062359: javac Attr crashes with NPE in TypeAnnotationsValidator visitNewClass

Michael Bayne mdb at samskivert.com
Tue Nov 18 17:02:52 UTC 2014


On Tue, Nov 18, 2014 at 5:36 AM, Jan Lahoda <jan.lahoda at oracle.com> wrote:

> Is there a chance to get the actual javac options+list of files (in the
> given order) that get passed to javac when the NPE happens? Might be
> possible to reproduce with that?
>

I haven't been able to reproduce it from the command line, but attached is
a standalone program that does the job.

% javac -classpath
/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/lib/tools.jar
AttrNPE.java
% java -classpath
.:/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/lib/tools.jar
AttrNPE
[various missing class errors ommitted]
Exception in thread "main" java.lang.NullPointerException
 at
com.sun.tools.javac.comp.Attr$TypeAnnotationsValidator.visitNewClass(Attr.java:4524)
 at com.sun.tools.javac.tree.JCTree$JCNewClass.accept(JCTree.java:1516)
 at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
 at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
 at com.sun.tools.javac.tree.TreeScanner.visitApply(TreeScanner.java:200)
 at
com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1465)
 at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
 at com.sun.tools.javac.tree.TreeScanner.visitReturn(TreeScanner.java:185)
 at com.sun.tools.javac.tree.JCTree$JCReturn.accept(JCTree.java:1384)
 at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
 at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
 at
com.sun.tools.javac.comp.Attr$TypeAnnotationsValidator.visitBlock(Attr.java:4557)
 at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:909)
 at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
 at
com.sun.tools.javac.comp.Attr$TypeAnnotationsValidator.visitMethodDef(Attr.java:4496)
 at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:778)
 at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
 at
com.sun.tools.javac.comp.Attr$TypeAnnotationsValidator.visitClassDef(Attr.java:4552)
 at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:693)
 at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
 at com.sun.tools.javac.tree.TreeScanner.visitNewClass(TreeScanner.java:208)
 at
com.sun.tools.javac.comp.Attr$TypeAnnotationsValidator.visitNewClass(Attr.java:4529)
 at com.sun.tools.javac.tree.JCTree$JCNewClass.accept(JCTree.java:1516)
 at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
 at
com.sun.tools.javac.comp.Attr$TypeAnnotationsValidator.visitVarDef(Attr.java:4505)
 at com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:852)
 at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
 at
com.sun.tools.javac.comp.Attr$TypeAnnotationsValidator.visitClassDef(Attr.java:4552)
 at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:693)
 at com.sun.tools.javac.comp.Attr.validateTypeAnnotations(Attr.java:4451)
 at com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:4375)
 at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4252)
 at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4201)
 at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4201)
 at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4205)
 at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4201)
 at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4201)
 at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4201)
 at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4201)
 at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4181)
 at com.sun.tools.javac.comp.Attr.visitClassDef(Attr.java:892)
 at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:693)
 at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:607)
 at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:676)
 at com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:4342)
 at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4252)
 at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4181)
 at com.sun.tools.javac.comp.Attr.attrib(Attr.java:4156)
 at com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1248)
 at com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1221)
 at com.sun.tools.javac.api.JavacTaskImpl.analyze(JavacTaskImpl.java:364)
 at com.sun.tools.javac.api.JavacTaskImpl.analyze(JavacTaskImpl.java:344)
 at AttrNPE.main(AttrNPE.java:38)


-- mdb at samskivert.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20141118/946939d9/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: AttrNPE.java
Type: application/octet-stream
Size: 1661 bytes
Desc: not available
URL: <http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20141118/946939d9/AttrNPE-0001.java>


More information about the compiler-dev mailing list