JDK-8182747 : javac crashes on bad annotation value
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 10
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2017-06-23
  • Updated: 2018-03-02
  • Resolved: 2017-06-29
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 10
10 b14Fixed
Related Reports
Relates :  
Description
The following program crashes javac:

class TestLVTI {

	static final Class<?> c = Object.class;

	@Anno1(c)
	void testAnno() {

	}
}

@interface Anno1 {
	Class<?> value();
}

Stacktrace is this:

An exception has occurred in the compiler (10-internal). 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.ClassCastException: jdk.compiler/com.sun.tools.javac.tree.JCTree$JCIdent cannot be cast to jdk.compiler/com.sun.tools.javac.tree.JCTree$JCFieldAccess
	at jdk.compiler/com.sun.tools.javac.comp.Annotate.getAnnotationClassValue(Annotate.java:633)
	at jdk.compiler/com.sun.tools.javac.comp.Annotate.attributeAnnotationValue(Annotate.java:590)
	at jdk.compiler/com.sun.tools.javac.comp.Annotate.attributeAnnotationNameValuePair(Annotate.java:511)
	at jdk.compiler/com.sun.tools.javac.comp.Annotate.attributeAnnotationValues(Annotate.java:476)
	at jdk.compiler/com.sun.tools.javac.comp.Annotate.attributeAnnotation(Annotate.java:411)
	at jdk.compiler/com.sun.tools.javac.comp.Annotate.annotateNow(Annotate.java:337)
	at jdk.compiler/com.sun.tools.javac.comp.Annotate.lambda$annotateLater$0(Annotate.java:263)
	at jdk.compiler/com.sun.tools.javac.comp.Annotate.flush(Annotate.java:187)
	at jdk.compiler/com.sun.tools.javac.comp.Annotate.unblockAnnotations(Annotate.java:140)
	at jdk.compiler/com.sun.tools.javac.comp.Annotate.enterDone(Annotate.java:153)
	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.enterDone(JavaCompiler.java:1726)
	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:1056)
	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:925)
	at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:305)
	at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:165)
	at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:55)
	at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:41)


Regression probably introduced in JDK-8181464.