-
Enhancement
-
Resolution: Unresolved
-
P3
-
None
-
8, 9, 10, 11, 12, 13
My colleague Alan Malloy discovered the following crash, which involves a circular enum declaration and annotation processing enabled:
=== EmptyProcessor.java
import java.util.Set;
import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.RoundEnvironment;
import javax.lang.model.element.TypeElement;
public class EmptyProcessor extends AbstractProcessor {
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
return false;
}
}
=== Mistake.java
public enum Mistake implements Mistake {
MISTAKE;
}
===
$ javac -fullversion
javac full version "13-ea+22"
$ javac EmptyProcessor.java
$ javac -processor EmptyProcessor Mistake.java
An exception has occurred in the compiler (13-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, the following diagnostic, and the parameters passed to the Java compiler in your report. Thank you.
java.lang.NullPointerException
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribIdentAsEnumType(Attr.java:927)
at jdk.compiler/com.sun.tools.javac.comp.MemberEnter.visitVarDef(MemberEnter.java:263)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:962)
at jdk.compiler/com.sun.tools.javac.comp.MemberEnter.memberEnter(MemberEnter.java:163)
at jdk.compiler/com.sun.tools.javac.comp.MemberEnter.memberEnter(MemberEnter.java:175)
=== EmptyProcessor.java
import java.util.Set;
import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.RoundEnvironment;
import javax.lang.model.element.TypeElement;
public class EmptyProcessor extends AbstractProcessor {
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
return false;
}
}
=== Mistake.java
public enum Mistake implements Mistake {
MISTAKE;
}
===
$ javac -fullversion
javac full version "13-ea+22"
$ javac EmptyProcessor.java
$ javac -processor EmptyProcessor Mistake.java
An exception has occurred in the compiler (13-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, the following diagnostic, and the parameters passed to the Java compiler in your report. Thank you.
java.lang.NullPointerException
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribIdentAsEnumType(Attr.java:927)
at jdk.compiler/com.sun.tools.javac.comp.MemberEnter.visitVarDef(MemberEnter.java:263)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:962)
at jdk.compiler/com.sun.tools.javac.comp.MemberEnter.memberEnter(MemberEnter.java:163)
at jdk.compiler/com.sun.tools.javac.comp.MemberEnter.memberEnter(MemberEnter.java:175)
- relates to
-
JDK-8228451 NPE in Attr.java when -XDshould-stop.ifError=FLOW
- Resolved
- links to
-
Review openjdk/jdk/1864