ADDITIONAL SYSTEM INFORMATION :
Hollis-MacBook-Pro:~ hwaite$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.14.2
BuildVersion: 18C54
Hollis-MacBook-Pro:~ hwaite$ java -version
java version "1.8.0_202-ea"
Java(TM) SE Runtime Environment (build 1.8.0_202-ea-b03)
Java HotSpot(TM) 64-Bit Server VM (build 25.202-b03, mixed mode)
A DESCRIPTION OF THE PROBLEM :
Compilation fails when we aggressively mix partially qualified, nested and/or wildcarded generics.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Attempt to compile code.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Code compiles.
ACTUAL -
Hollis-MacBook-Pro:~ hwaite$ javac Foo.java Bar.java
An exception has occurred in the compiler (1.8.0_202-ea). 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.NullPointerException
at com.sun.tools.javac.comp.Check$Validator.visitSelect(Check.java:1310)
at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1897)
at com.sun.tools.javac.comp.Check$Validator.validateTree(Check.java:1359)
at com.sun.tools.javac.comp.Check$Validator.visitWildcard(Check.java:1305)
at com.sun.tools.javac.tree.JCTree$JCWildcard.accept(JCTree.java:2253)
at com.sun.tools.javac.comp.Check$Validator.validateTree(Check.java:1359)
at com.sun.tools.javac.comp.Check$Validator.visitTypeApply(Check.java:1280)
at com.sun.tools.javac.tree.JCTree$JCTypeApply.accept(JCTree.java:2135)
at com.sun.tools.javac.comp.Check$Validator.validateTree(Check.java:1359)
at com.sun.tools.javac.comp.Check$Validator.visitTypeApply(Check.java:1280)
at com.sun.tools.javac.tree.JCTree$JCTypeApply.accept(JCTree.java:2135)
at com.sun.tools.javac.comp.Check$Validator.validateTree(Check.java:1359)
at com.sun.tools.javac.comp.Check.validate(Check.java:1230)
at com.sun.tools.javac.comp.Attr.visitVarDef(Attr.java:1055)
at com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:852)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:576)
at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:645)
at com.sun.tools.javac.comp.Attr.attribStats(Attr.java:661)
at com.sun.tools.javac.comp.Attr.visitLambda(Attr.java:2316)
at com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1624)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:576)
at com.sun.tools.javac.comp.DeferredAttr.attribSpeculative(DeferredAttr.java:387)
at com.sun.tools.javac.comp.DeferredAttr$2.complete(DeferredAttr.java:280)
at com.sun.tools.javac.comp.DeferredAttr$DeferredType.check(DeferredAttr.java:246)
at com.sun.tools.javac.comp.DeferredAttr$DeferredType.check(DeferredAttr.java:233)
at com.sun.tools.javac.comp.DeferredAttr$RecoveryDeferredTypeMap.recover(DeferredAttr.java:883)
at com.sun.tools.javac.comp.DeferredAttr$RecoveryDeferredTypeMap.typeOf(DeferredAttr.java:872)
at com.sun.tools.javac.comp.DeferredAttr$DeferredTypeMap.apply(DeferredAttr.java:839)
at com.sun.tools.javac.comp.DeferredAttr$RecoveryDeferredTypeMap.apply(DeferredAttr.java:862)
at com.sun.tools.javac.code.Type.map(Type.java:221)
at com.sun.tools.javac.code.Type$MethodType.map(Type.java:1189)
at com.sun.tools.javac.comp.DeferredAttr$DeferredTypeMap.apply(DeferredAttr.java:836)
at com.sun.tools.javac.comp.DeferredAttr$RecoveryDeferredTypeMap.apply(DeferredAttr.java:862)
at com.sun.tools.javac.code.Type$ForAll.map(Type.java:1429)
at com.sun.tools.javac.comp.Attr.checkMethodIdInternal(Attr.java:3522)
at com.sun.tools.javac.comp.Attr.checkMethodId(Attr.java:3502)
at com.sun.tools.javac.comp.Attr.checkId(Attr.java:3489)
at com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:3371)
at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1897)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:576)
at com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1825)
at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1465)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:576)
at com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:3250)
at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1897)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:576)
at com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1825)
at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1465)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:576)
at com.sun.tools.javac.comp.Attr.visitLambda(Attr.java:2398)
at com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1624)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:576)
at com.sun.tools.javac.comp.DeferredAttr.attribSpeculative(DeferredAttr.java:387)
at com.sun.tools.javac.comp.DeferredAttr$2.complete(DeferredAttr.java:280)
at com.sun.tools.javac.comp.DeferredAttr$DeferredType.check(DeferredAttr.java:246)
at com.sun.tools.javac.comp.DeferredAttr$DeferredType.check(DeferredAttr.java:233)
at com.sun.tools.javac.comp.Resolve$MethodResultInfo.check(Resolve.java:1008)
at com.sun.tools.javac.comp.Resolve$4.checkArg(Resolve.java:835)
at com.sun.tools.javac.comp.Resolve$AbstractMethodCheck.argumentsAcceptable(Resolve.java:735)
at com.sun.tools.javac.comp.Resolve$4.argumentsAcceptable(Resolve.java:844)
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:1446)
at com.sun.tools.javac.comp.Resolve.findMethodInScope(Resolve.java:1633)
at com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:1704)
at com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:1677)
at com.sun.tools.javac.comp.Resolve.findFun(Resolve.java:1840)
at com.sun.tools.javac.comp.Resolve$8.doLookup(Resolve.java:2404)
at com.sun.tools.javac.comp.Resolve$BasicLookupHelper.lookup(Resolve.java:3097)
at com.sun.tools.javac.comp.Resolve.lookupMethod(Resolve.java:3348)
at com.sun.tools.javac.comp.Resolve.lookupMethod(Resolve.java:3333)
at com.sun.tools.javac.comp.Resolve.resolveMethod(Resolve.java:2400)
at com.sun.tools.javac.comp.Attr.visitIdent(Attr.java:3166)
at com.sun.tools.javac.tree.JCTree$JCIdent.accept(JCTree.java:2011)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:576)
at com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1825)
at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1465)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:576)
at com.sun.tools.javac.comp.DeferredAttr.attribSpeculative(DeferredAttr.java:387)
at com.sun.tools.javac.comp.DeferredAttr$2.complete(DeferredAttr.java:280)
at com.sun.tools.javac.comp.DeferredAttr$DeferredType.check(DeferredAttr.java:246)
at com.sun.tools.javac.comp.DeferredAttr$DeferredType.check(DeferredAttr.java:233)
at com.sun.tools.javac.comp.Resolve$MethodResultInfo.check(Resolve.java:1008)
at com.sun.tools.javac.comp.Resolve$4.checkArg(Resolve.java:835)
at com.sun.tools.javac.comp.Resolve$AbstractMethodCheck.argumentsAcceptable(Resolve.java:735)
at com.sun.tools.javac.comp.Resolve$4.argumentsAcceptable(Resolve.java:844)
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:1446)
at com.sun.tools.javac.comp.Resolve.findDiamond(Resolve.java:2660)
at com.sun.tools.javac.comp.Resolve.access$1000(Resolve.java:80)
at com.sun.tools.javac.comp.Resolve$12.doLookup(Resolve.java:2595)
at com.sun.tools.javac.comp.Resolve$BasicLookupHelper.lookup(Resolve.java:3097)
at com.sun.tools.javac.comp.Resolve.lookupMethod(Resolve.java:3348)
at com.sun.tools.javac.comp.Resolve.lookupMethod(Resolve.java:3333)
at com.sun.tools.javac.comp.Resolve.resolveDiamond(Resolve.java:2591)
at com.sun.tools.javac.comp.Attr.visitNewClass(Attr.java:2040)
at com.sun.tools.javac.tree.JCTree$JCNewClass.accept(JCTree.java:1516)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:576)
at com.sun.tools.javac.comp.Attr.visitLambda(Attr.java:2398)
at com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1624)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:576)
at com.sun.tools.javac.comp.DeferredAttr$2.complete(DeferredAttr.java:285)
at com.sun.tools.javac.comp.DeferredAttr$DeferredType.check(DeferredAttr.java:246)
at com.sun.tools.javac.comp.DeferredAttr$DeferredType.check(DeferredAttr.java:233)
at com.sun.tools.javac.comp.DeferredAttr$RecoveryDeferredTypeMap.recover(DeferredAttr.java:883)
at com.sun.tools.javac.comp.DeferredAttr$RecoveryDeferredTypeMap.typeOf(DeferredAttr.java:872)
at com.sun.tools.javac.comp.Resolve$ResolveDeferredRecoveryMap.typeOf(Resolve.java:2310)
at com.sun.tools.javac.comp.DeferredAttr$DeferredTypeMap.apply(DeferredAttr.java:839)
at com.sun.tools.javac.comp.DeferredAttr$RecoveryDeferredTypeMap.apply(DeferredAttr.java:862)
at com.sun.tools.javac.code.Type.map(Type.java:221)
at com.sun.tools.javac.code.Type.map(Type.java:220)
at com.sun.tools.javac.comp.Attr.checkMethod(Attr.java:3873)
at com.sun.tools.javac.comp.Attr.checkIdInternal(Attr.java:3616)
at com.sun.tools.javac.comp.Attr.checkMethodIdInternal(Attr.java:3523)
at com.sun.tools.javac.comp.Attr.checkMethodId(Attr.java:3502)
at com.sun.tools.javac.comp.Attr.checkId(Attr.java:3489)
at com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1808)
at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1465)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:576)
at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:625)
at com.sun.tools.javac.comp.Attr.visitExec(Attr.java:1593)
at com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1296)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:576)
at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:645)
at com.sun.tools.javac.comp.Attr.attribStats(Attr.java:661)
at com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:1124)
at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:909)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:576)
at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:645)
at com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:1013)
at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:778)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:576)
at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:645)
at com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:4364)
at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4272)
at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4201)
at com.sun.tools.javac.comp.Attr.attrib(Attr.java:4176)
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)
---------- BEGIN SOURCE ----------
import java.util.Optional;
import java.util.function.Function;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.value.ObservableValue;
import javafx.collections.ObservableList;
public class Foo<T> {
public Foo(
ObservableList<? extends T> pArg1,
ObservableValue<? extends Function<? super T,ObservableValue<?>>> pArg2
) {
this(
pArg1,
pVal -> new Bar<>(
map(
pArg2,
pFunction -> Optional.ofNullable(pFunction).map(
pFunc -> pFunc.apply(pVal)
).orElse(new SimpleObjectProperty())
)
)
);
}
public Foo(
ObservableList<? extends T> pArg1,
Function<? super T,? extends ObservableValue<?>> pArg2
) {
}
public static <T, U> ObservableValue<U> map(ObservableValue<T> pArg1, Function<T, U> pArg2) {
return new SimpleObjectProperty<>();
}
}
import javafx.beans.value.ObservableValue;
import javafx.beans.value.ObservableValueBase;
public class Bar<T> extends ObservableValueBase<T> {
public Bar(ObservableValue<? extends ObservableValue<? extends T>> pArg1) {}
@Override public T getValue() {return null;}
public static void main(String[] pArgs) {}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Remove wildcards from constructor
FREQUENCY : always