JDK-8130304 : Inference: NodeNotFoundException thrown with deep generic method call chain
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 8-pool,9
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_7
  • CPU: x86_64
  • Submitted: 2015-05-28
  • Updated: 2016-07-21
  • Resolved: 2015-07-17
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 8 JDK 9
8u102Fixed 9 b75Fixed
Related Reports
Relates :  
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]

A DESCRIPTION OF THE PROBLEM :
com.sun.tools.javac.comp.Infer$GraphStrategy$NodeNotFoundException occurs when compiling the attached executable test case.

REGRESSION.  Last worked in version 7u80

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
javac VerfuegbareTarifkalender.java

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
no errors: javac exits with code 0
ACTUAL -
javac exits with code 4

ERROR MESSAGES/STACK TRACES THAT OCCUR :
An exception has occurred in the compiler (1.8.0_45). 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.
com.sun.tools.javac.comp.Infer$GraphStrategy$NodeNotFoundException
        at com.sun.tools.javac.comp.Infer$LeafSolver.pickNode(Infer.java:1217)
        at com.sun.tools.javac.comp.Infer$GraphSolver.solve(Infer.java:1585)
        at com.sun.tools.javac.comp.Infer$InferenceContext.solve(Infer.java:2204)
        at com.sun.tools.javac.comp.Infer$InferenceContext.solve(Infer.java:2196)
        at com.sun.tools.javac.comp.Infer$InferenceContext.solve(Infer.java:2211)
        at com.sun.tools.javac.comp.Infer.instantiateMethod(Infer.java:186)
        at com.sun.tools.javac.comp.Resolve.rawInstantiate(Resolve.java:567)
        at com.sun.tools.javac.comp.Resolve.selectBest(Resolve.java:1441)
        at com.sun.tools.javac.comp.Resolve.findMethodInScope(Resolve.java:1628)
        at com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:1699)
        at com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:1672)
        at com.sun.tools.javac.comp.Resolve.findFun(Resolve.java:1832)
        at com.sun.tools.javac.comp.Resolve$8.doLookup(Resolve.java:2393)
        at com.sun.tools.javac.comp.Resolve$BasicLookupHelper.lookup(Resolve.java:3084)
        at com.sun.tools.javac.comp.Resolve.lookupMethod(Resolve.java:3335)
        at com.sun.tools.javac.comp.Resolve.lookupMethod(Resolve.java:3320)
        at com.sun.tools.javac.comp.Resolve.resolveMethod(Resolve.java:2389)
        at com.sun.tools.javac.comp.Attr.visitIdent(Attr.java:3134)
        at com.sun.tools.javac.tree.JCTree$JCIdent.accept(JCTree.java:2011)
        at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:566)
        at com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1806)
        at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1465)
        at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:566)
        at com.sun.tools.javac.comp.DeferredAttr.attribSpeculative(DeferredAttr.java:386)
        at com.sun.tools.javac.comp.DeferredAttr$2.complete(DeferredAttr.java:279)
        at com.sun.tools.javac.comp.DeferredAttr$DeferredType.check(DeferredAttr.java:245)
        at com.sun.tools.javac.comp.DeferredAttr$DeferredType.check(DeferredAttr.java:232)
        at com.sun.tools.javac.comp.Resolve$MethodResultInfo.check(Resolve.java:1003)
        at com.sun.tools.javac.comp.Resolve$4.checkArg(Resolve.java:829)
        at com.sun.tools.javac.comp.Resolve$AbstractMethodCheck.argumentsAcceptable(Resolve.java:734)
        at com.sun.tools.javac.comp.Resolve$4.argumentsAcceptable(Resolve.java:838)
        at com.sun.tools.javac.comp.Infer.instantiateMethod(Infer.java:162)
        at com.sun.tools.javac.comp.Resolve.rawInstantiate(Resolve.java:567)
        at com.sun.tools.javac.comp.Resolve.selectBest(Resolve.java:1441)
        at com.sun.tools.javac.comp.Resolve.findMethodInScope(Resolve.java:1628)
        at com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:1699)
        at com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:1672)
        at com.sun.tools.javac.comp.Resolve.findFun(Resolve.java:1832)
        at com.sun.tools.javac.comp.Resolve$8.doLookup(Resolve.java:2393)
        at com.sun.tools.javac.comp.Resolve$BasicLookupHelper.lookup(Resolve.java:3084)
        at com.sun.tools.javac.comp.Resolve.lookupMethod(Resolve.java:3335)
        at com.sun.tools.javac.comp.Resolve.lookupMethod(Resolve.java:3320)
        at com.sun.tools.javac.comp.Resolve.resolveMethod(Resolve.java:2389)
        at com.sun.tools.javac.comp.Attr.visitIdent(Attr.java:3134)
        at com.sun.tools.javac.tree.JCTree$JCIdent.accept(JCTree.java:2011)
        at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:566)
        at com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1806)
        at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1465)
        at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:566)
        at com.sun.tools.javac.comp.DeferredAttr.attribSpeculative(DeferredAttr.java:386)
        at com.sun.tools.javac.comp.DeferredAttr$2.complete(DeferredAttr.java:279)
        at com.sun.tools.javac.comp.DeferredAttr$DeferredType.check(DeferredAttr.java:245)
        at com.sun.tools.javac.comp.DeferredAttr$DeferredType.check(DeferredAttr.java:232)
        at com.sun.tools.javac.comp.Resolve$MethodResultInfo.check(Resolve.java:1003)
        at com.sun.tools.javac.comp.Resolve$4.checkArg(Resolve.java:829)
        at com.sun.tools.javac.comp.Resolve$AbstractMethodCheck.argumentsAcceptable(Resolve.java:734)
        at com.sun.tools.javac.comp.Resolve$4.argumentsAcceptable(Resolve.java:838)
        at com.sun.tools.javac.comp.Infer.instantiateMethod(Infer.java:162)
        at com.sun.tools.javac.comp.Resolve.rawInstantiate(Resolve.java:567)
        at com.sun.tools.javac.comp.Resolve.selectBest(Resolve.java:1441)
        at com.sun.tools.javac.comp.Resolve.findMethodInScope(Resolve.java:1628)
        at com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:1699)
        at com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:1672)
        at com.sun.tools.javac.comp.Resolve.findFun(Resolve.java:1832)
        at com.sun.tools.javac.comp.Resolve$8.doLookup(Resolve.java:2393)
        at com.sun.tools.javac.comp.Resolve$BasicLookupHelper.lookup(Resolve.java:3084)
        at com.sun.tools.javac.comp.Resolve.lookupMethod(Resolve.java:3335)
        at com.sun.tools.javac.comp.Resolve.lookupMethod(Resolve.java:3320)
        at com.sun.tools.javac.comp.Resolve.resolveMethod(Resolve.java:2389)
        at com.sun.tools.javac.comp.Attr.visitIdent(Attr.java:3134)
        at com.sun.tools.javac.tree.JCTree$JCIdent.accept(JCTree.java:2011)
        at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:566)
        at com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1806)
        at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1465)
        at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:566)
        at com.sun.tools.javac.comp.DeferredAttr.attribSpeculative(DeferredAttr.java:386)
        at com.sun.tools.javac.comp.DeferredAttr$2.complete(DeferredAttr.java:279)
        at com.sun.tools.javac.comp.DeferredAttr$DeferredType.check(DeferredAttr.java:245)
        at com.sun.tools.javac.comp.DeferredAttr$DeferredType.check(DeferredAttr.java:232)
        at com.sun.tools.javac.comp.Resolve$MethodResultInfo.check(Resolve.java:1003)
        at com.sun.tools.javac.comp.Resolve$4.checkArg(Resolve.java:829)
        at com.sun.tools.javac.comp.Resolve$AbstractMethodCheck.argumentsAcceptable(Resolve.java:734)
        at com.sun.tools.javac.comp.Resolve$4.argumentsAcceptable(Resolve.java:838)
        at com.sun.tools.javac.comp.Infer.instantiateMethod(Infer.java:162)
        at com.sun.tools.javac.comp.Resolve.rawInstantiate(Resolve.java:567)
        at com.sun.tools.javac.comp.Resolve.selectBest(Resolve.java:1441)
        at com.sun.tools.javac.comp.Resolve.findMethodInScope(Resolve.java:1628)
        at com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:1699)
        at com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:1672)
        at com.sun.tools.javac.comp.Resolve.findFun(Resolve.java:1832)
        at com.sun.tools.javac.comp.Resolve$8.doLookup(Resolve.java:2393)
        at com.sun.tools.javac.comp.Resolve$BasicLookupHelper.lookup(Resolve.java:3084)
        at com.sun.tools.javac.comp.Resolve.lookupMethod(Resolve.java:3335)
        at com.sun.tools.javac.comp.Resolve.lookupMethod(Resolve.java:3320)
        at com.sun.tools.javac.comp.Resolve.resolveMethod(Resolve.java:2389)
        at com.sun.tools.javac.comp.Attr.visitIdent(Attr.java:3134)
        at com.sun.tools.javac.tree.JCTree$JCIdent.accept(JCTree.java:2011)
        at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:566)
        at com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1806)
        at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1465)
        at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:566)
        at com.sun.tools.javac.comp.Attr.visitReturn(Attr.java:1667)
        at com.sun.tools.javac.tree.JCTree$JCReturn.accept(JCTree.java:1384)
        at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:566)
        at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:635)
        at com.sun.tools.javac.comp.Attr.attribStats(Attr.java:651)
        at com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:1105)
        at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:909)
        at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:566)
        at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:635)
        at com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:994)
        at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:778)
        at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:566)
        at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:635)
        at com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:4330)
        at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4240)
        at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4169)
        at com.sun.tools.javac.comp.Attr.attrib(Attr.java:4144)
        at com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1248)
        at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:901)
        at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:860)
        at com.sun.tools.javac.main.Main.compile(Main.java:523)
        at com.sun.tools.javac.main.Main.compile(Main.java:381)
        at com.sun.tools.javac.main.Main.compile(Main.java:370)
        at com.sun.tools.javac.main.Main.compile(Main.java:361)
        at com.sun.tools.javac.Main.compile(Main.java:56)
        at com.sun.tools.javac.Main.main(Main.java:42)


REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
class VerfuegbareTarifkalender {

    private Donor kalenderSommerWinter() {
        return a(
                with(null, listOf(
                        a(
                                with(null, null),
                                with(null, listOf(
                                        a(
                                                with(null, null),
                                                with(null, null),
                                                with(null, null),
                                                with(null, null),
                                                with(null, null)
                                        ),
                                        a(
                                                with(null, null),
                                                with(null, null),
                                                with(null, null),
                                                with(null, null),
                                                with(null, null),
                                                with(null, null),
                                                with(null, null),
                                                with(null, null)
                                        ),
                                        a(
                                                with(null, null),
                                                with(null, null),
                                                with(null, null),
                                                with(null, null),
                                                with(null, null),
                                                with(null, null),
                                                with(null, null),
                                                with(null, null)
                                        ),
                                        a(
                                                with(null, null),
                                                with(null, null),
                                                with(null, null),
                                                with(null, null),
                                                with(null, null),
                                                with(null, null),
                                                with(null, null),
                                                with(null, null)
                                        )
                                ))
                        )
                ))
        );
    }

    interface List<T> {}
    interface Donor<T> {}
    class PropertyValue<T, V> {}

    static <T> Donor<T> a(PropertyValue<T, ?>... propertyProviders) {
        return null;
    }

    static <T,V,W extends V> PropertyValue<T,V> with(Object property, Donor<W> valueDonor) {
        return null;
    }

    static <T> Donor<List<T>> listOf(Donor<? extends T>... donors) {
        return null;
    }
}

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
- either use 1.7 source language level
or
- change signature of the with() method: 
remove type parameters from return type:
 static <T,V,W extends V> PropertyValue with(Object property, Donor<W> valueDonor) {
        return null;
    }

SUPPORT :
YES


Comments
Tarjan algorithm overflows (!!) - the number of steps exceeds the size of an 'int' value; unfortunately, switching to long removes the crash, but compilation never finishes (possibly a dup of JDK-8046685).
14-07-2015

1. Run the attached test case (VerfuegbareTarifkalender.java) in Windows 7 and Linux (64-bit). 2. Checked this for JDK 7u80, 8, 8u45, 8u60 ea b21, and 9 ea b70. ----------------------------------------------------------------------- Result: ----------- 7u80: OK 8: FAIL 8u45: FAIL 8u60 ea b21: FAIL 9 ea b70: FAIL 3. Output with JDK 8u45: ------------------------------------- $ javac VerfuegbareTarifkalender.java An exception has occurred in the compiler (1.8.0_45). 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. com.sun.tools.javac.comp.Infer$GraphStrategy$NodeNotFoundException at com.sun.tools.javac.comp.Infer$LeafSolver.pickNode(Infer.java:1217) at com.sun.tools.javac.comp.Infer$GraphSolver.solve(Infer.java:1585) at com.sun.tools.javac.comp.Infer$InferenceContext.solve(Infer.java:2204) at com.sun.tools.javac.comp.Infer$InferenceContext.solve(Infer.java:2196) .............. ............... 4. The issue is reproducible with JDK 8-all and 9 ea b70. The code compiles without error with JDK 7u80. This looks like a regression with JDK 8 and onwards. Moving this up for further evaluation.
02-07-2015