ADDITIONAL SYSTEM INFORMATION :
java version "1.8.0_192-ea"
Java(TM) SE Runtime Environment (build 1.8.0_192-ea-b04)
Java HotSpot(TM) 64-Bit Server VM (build 25.192-b04, mixed mode)
Windows 10 Enterprise, version 1709, build 16299.611
A DESCRIPTION OF THE PROBLEM :
When compiling the attached source code, the compiler throws a NullPointerException.
This problem was observed when updating javaee-api from 7.0 to 8.0.
The exception occurs on 8u131, 8u181 and 8u192ea.
It does not occur on 10.0.1 and 11-ea.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the java compiler on the four input java files.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Compilation succeeds.
ACTUAL -
An exception has occurred in the compiler (1.8.0_192-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.code.Types.removeWildcards(Types.java:601)
at com.sun.tools.javac.code.Types$DescriptorCache$FunctionDescriptor.getType(Types.java:362)
at com.sun.tools.javac.code.Types.findDescriptorType(Types.java:568)
at com.sun.tools.javac.code.Types.isFunctionalInterface(Types.java:585)
at com.sun.tools.javac.comp.DeferredAttr$CheckStuckPolicy.visitLambda(DeferredAttr.java:997)
at com.sun.tools.javac.comp.DeferredAttr$OverloadStuckPolicy.visitLambda(DeferredAttr.java:1080)
at com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1624)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at com.sun.tools.javac.comp.DeferredAttr$FilterScanner.scan(DeferredAttr.java:913)
at com.sun.tools.javac.comp.DeferredAttr$CheckStuckPolicy.<init>(DeferredAttr.java:980)
at com.sun.tools.javac.comp.DeferredAttr$OverloadStuckPolicy.<init>(DeferredAttr.java:1075)
at com.sun.tools.javac.comp.DeferredAttr$DeferredType.check(DeferredAttr.java:229)
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.Resolve.rawInstantiate(Resolve.java:579)
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.findConstructor(Resolve.java:2568)
at com.sun.tools.javac.comp.Resolve$11.doLookup(Resolve.java:2537)
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.resolveConstructor(Resolve.java:2534)
at com.sun.tools.javac.comp.Resolve.resolveConstructor(Resolve.java:2525)
at com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1798)
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 ----------
public interface Call<T extends Exception>
{
void run() throws T;
}
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.TYPE_USE;
@Target(TYPE_USE)
public @interface NotNull {
}
public class Parent
{
public Parent(@NotNull Call initAlgorithm)
{
}
}
public class Child extends Parent
{
public Child()
{
super(() -> {});
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Add generic parameters to Call in the Parent constructor.
Alternatively, do not use TYPE_USE on the annotation.
FREQUENCY : always