JDK-8171320 : NPE in Attr.visitVarDef
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 9
  • Priority: P4
  • Status: Resolved
  • Resolution: Duplicate
  • Submitted: 2016-12-15
  • Updated: 2017-12-04
  • Resolved: 2017-12-04
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 10
10Resolved
Related Reports
Duplicate :  
Description
The following program crashes javac 9-ea+149:

===
import java.util.function.*;
class Test {
  @interface I { String x(); }
  static <F, T> T apply(T x, Function<F, T> f) { return f.apply(x); } 

  @I(x = apply("X", x -> x.toString())) int x;
}
===

java.lang.NullPointerException
        at jdk.compiler/com.sun.tools.javac.comp.Attr.visitVarDef(Attr.java:1110)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:950)
        at jdk.compiler/com.sun.tools.javac.comp.Attr$ResultInfo.attr(Attr.java:501)
        at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:639)
        at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:708)
        at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStats(Attr.java:727)
        at jdk.compiler/com.sun.tools.javac.comp.Attr.visitLambda(Attr.java:2454)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1801)
        at jdk.compiler/com.sun.tools.javac.comp.Attr$ResultInfo.attr(Attr.java:501)
        at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:639)
        at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$4.complete(DeferredAttr.java:340)
        at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredType.check(DeferredAttr.java:301)
        at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredType.access$000(DeferredAttr.java:172)
        at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredAttrNode.process(DeferredAttr.java:741)
        at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredAttrContext.complete(DeferredAttr.java:585)
        at jdk.compiler/com.sun.tools.javac.comp.Infer.instantiateMethod(Infer.java:220)
        at jdk.compiler/com.sun.tools.javac.comp.Resolve.rawInstantiate(Resolve.java:589)
        at jdk.compiler/com.sun.tools.javac.comp.Resolve.checkMethod(Resolve.java:628)
        at jdk.compiler/com.sun.tools.javac.comp.Attr.checkMethod(Attr.java:3973)
Comments
Problem goes away with the fix for JDK-8181464
04-12-2017