-
Bug
-
Resolution: Fixed
-
P2
-
9, 10, 10.0.1, 11
-
b22
-
x86_64
-
generic
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8291864 | 11.0.18-oracle | Adam Sotona | P2 | Closed | Fixed | b01 |
JDK-8290089 | 11.0.17 | Dukebot | P2 | Resolved | Fixed | b01 |
Linux (4.9.96-1-MANJARO) x86_64
OpenJDK 64-Bit Server VM (build 10.0.1+10, mixed mode)
and also OpenJDK 64-Bit Server VM (build 9.0.4+11, mixed mode)
A DESCRIPTION OF THE PROBLEM :
On complex diamond type inference, javac raise an exception without giving any information on the cause of the inference exception
REGRESSION : Last worked in version 8u172
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
compile the class associated to the report.
guava-24.0 is required in the classpath
$ javac -classpath guava-24.0-jre.jar TestFail.java
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
It compile or at least give interesting information about the cause and location of the failure
ACTUAL -
An exception has occurred in the compiler (9.0.4). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program and the following diagnostic in your report. Thank you.
java.lang.AssertionError: isSubtype UNKNOWN
at jdk.compiler/com.sun.tools.javac.code.Types$4.visitType(Types.java:803)
at jdk.compiler/com.sun.tools.javac.code.Types$4.visitType(Types.java:780)
at jdk.compiler/com.sun.tools.javac.code.Type.accept(Type.java:214)
at jdk.compiler/com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:4614)
at jdk.compiler/com.sun.tools.javac.code.Types.isSubtype(Types.java:776)
at jdk.compiler/com.sun.tools.javac.code.Types.isSubtypeUncheckedInternal(Types.java:702)
at jdk.compiler/com.sun.tools.javac.code.Types.isSubtypeUnchecked(Types.java:688)
at jdk.compiler/com.sun.tools.javac.code.Types.isConvertible(Types.java:311)
at jdk.compiler/com.sun.tools.javac.code.Types.isAssignable(Types.java:2070)
at jdk.compiler/com.sun.tools.javac.comp.Check$1.compatible(Check.java:536)
at jdk.compiler/com.sun.tools.javac.comp.Check.checkType(Check.java:577)
at jdk.compiler/com.sun.tools.javac.comp.Check.checkType(Check.java:564)
at jdk.compiler/com.sun.tools.javac.comp.Annotate.attributeAnnotationValues(Annotate.java:452)
at jdk.compiler/com.sun.tools.javac.comp.Annotate.attributeAnnotation(Annotate.java:408)
at jdk.compiler/com.sun.tools.javac.comp.Annotate.annotateNow(Annotate.java:334)
at jdk.compiler/com.sun.tools.javac.comp.Annotate.lambda$annotateLater$0(Annotate.java:260)
at jdk.compiler/com.sun.tools.javac.comp.Annotate.flush(Annotate.java:184)
at jdk.compiler/com.sun.tools.javac.comp.Annotate.unblockAnnotations(Annotate.java:137)
at jdk.compiler/com.sun.tools.javac.comp.TypeEnter.complete(TypeEnter.java:210)
at jdk.compiler/com.sun.tools.javac.code.Symbol.complete(Symbol.java:633)
at jdk.compiler/com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:1314)
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitClassDef(Attr.java:936)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:774)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:653)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:723)
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitAnonymousClassDefinition(Attr.java:2302)
at jdk.compiler/com.sun.tools.javac.comp.Attr.lambda$visitAnonymousClassDefinition$2(Attr.java:2261)
at jdk.compiler/com.sun.tools.javac.comp.InferenceContext.notifyChange(InferenceContext.java:265)
at jdk.compiler/com.sun.tools.javac.comp.InferenceContext.notifyChange(InferenceContext.java:256)
at jdk.compiler/com.sun.tools.javac.comp.Infer.instantiateMethod(Infer.java:248)
at jdk.compiler/com.sun.tools.javac.comp.Resolve.rawInstantiate(Resolve.java:604)
at jdk.compiler/com.sun.tools.javac.comp.Resolve.checkMethod(Resolve.java:643)
at jdk.compiler/com.sun.tools.javac.comp.Attr.checkMethod(Attr.java:3998)
at jdk.compiler/com.sun.tools.javac.comp.Attr.checkIdInternal(Attr.java:3791)
at jdk.compiler/com.sun.tools.javac.comp.Attr.checkMethodIdInternal(Attr.java:3698)
at jdk.compiler/com.sun.tools.javac.comp.Attr.checkMethodId(Attr.java:3677)
at jdk.compiler/com.sun.tools.javac.comp.Attr.checkId(Attr.java:3664)
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:3549)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:2104)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:653)
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1911)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1628)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:653)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:693)
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitVarDef(Attr.java:1155)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:950)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:653)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:723)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStats(Attr.java:742)
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:1203)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1014)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:653)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:723)
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:1094)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:866)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:653)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:723)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:4562)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4454)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4383)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attrib(Attr.java:4328)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1329)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:959)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:302)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:162)
at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:57)
at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:43)
---------- BEGIN SOURCE ----------
import java.util.List;
import java.util.function.Function;
import com.google.common.collect.Lists;
public final class TestFail {
public void build() {
List<Function<String, Double>> partialComputers = Lists.transform(null, builder -> new Function<>() {
@Override public Double apply(String params) { return null; }
@Override public String toString() { return null; }
});
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
import java.util.List;
import java.util.function.Function;
import com.google.common.collect.Lists;
public final class TestOk {
public void build() {
List<Function<String, Double>> partialComputers = Lists.transform(null, builder -> new Function<String, Double>() {
@Override public Double apply(String params) { return null; }
@Override public String toString() { return null; }
});
}
}
FREQUENCY : always
- backported by
-
JDK-8290089 preflow visitor used during lambda attribution shouldn't visit class definitions inside the lambda body
-
- Resolved
-
-
JDK-8291864 preflow visitor used during lambda attribution shouldn't visit class definitions inside the lambda body
-
- Closed
-
- duplicates
-
JDK-8217234 Compiler exception when using lambda returning generic object
-
- Closed
-
-
JDK-8232599 Compiler crashes when using generics
-
- Closed
-
-
JDK-8200564 Parameter cannot accept a lambda returning a generic object with an inferred type
-
- Closed
-
-
JDK-8246111 Instantiating a generic inner class inside a lambda causes a compiler crash
-
- Closed
-
-
JDK-8267220 javac crashes at com.sun.tools.javac.code.Types$7.visitType with AssertionError
-
- Closed
-
- relates to
-
JDK-8222251 preflow visitor is not visiting lambda expressions
-
- Closed
-