]
Will Burns updated ISPN-11675:
------------------------------
Status: Resolved (was: Pull Request Sent)
Resolution: Done
ComponentAnnotationProcessor exception hides compilation error
--------------------------------------------------------------
Key: ISPN-11675
URL:
https://issues.redhat.com/browse/ISPN-11675
Project: Infinispan
Issue Type: Bug
Components: Build, Core
Affects Versions: 11.0.0.Dev04, 10.1.6.Final
Reporter: Dan Berindei
Assignee: Dan Berindei
Priority: Major
Fix For: 11.0.0.Dev05
When a source file has a component annotation with an invalid value, e.g.
{{@DefaultFactoryFor(classes = \{NonExistentClass.class\})}},
{{ComponentAnnotationProcessor}} hits a {{ClassCastException}}:
{noformat}
Error:java: ComponentAnnotationProcessor unexpected error: java.lang.ClassCastException:
class com.sun.tools.javac.code.Attribute$UnresolvedClass cannot be cast to class
com.sun.tools.javac.code.Attribute$Class
(com.sun.tools.javac.code.Attribute$UnresolvedClass and
com.sun.tools.javac.code.Attribute$Class are in module jdk.compiler of loader
'app')
at
jdk.compiler/com.sun.tools.javac.model.AnnotationProxyMaker$ValueVisitor.visitArray(AnnotationProxyMaker.java:192)
at jdk.compiler/com.sun.tools.javac.code.Attribute$Array.accept(Attribute.java:327)
at
jdk.compiler/com.sun.tools.javac.model.AnnotationProxyMaker$ValueVisitor.getValue(AnnotationProxyMaker.java:167)
at
jdk.compiler/com.sun.tools.javac.model.AnnotationProxyMaker.generateValue(AnnotationProxyMaker.java:145)
at
jdk.compiler/com.sun.tools.javac.model.AnnotationProxyMaker.getAllReflectedValues(AnnotationProxyMaker.java:104)
at
jdk.compiler/com.sun.tools.javac.model.AnnotationProxyMaker.generateAnnotation(AnnotationProxyMaker.java:90)
at
jdk.compiler/com.sun.tools.javac.model.AnnotationProxyMaker.generateAnnotation(AnnotationProxyMaker.java:81)
at
jdk.compiler/com.sun.tools.javac.code.AnnoConstruct.getAnnotation(AnnoConstruct.java:185)
at
org.infinispan.component.processor.ComponentAnnotationProcessor$ModelBuilder.getFactoryComponentNames(ComponentAnnotationProcessor.java:606)
at
org.infinispan.component.processor.ComponentAnnotationProcessor$ModelBuilder.visitType(ComponentAnnotationProcessor.java:318)
at
org.infinispan.component.processor.ComponentAnnotationProcessor$ModelBuilder.visitType(ComponentAnnotationProcessor.java:281)
at jdk.compiler/com.sun.tools.javac.code.Symbol$ClassSymbol.accept(Symbol.java:1477)
at
java.compiler@13.0.1/javax.lang.model.util.ElementScanner6.scan(ElementScanner6.java:153)
at
java.compiler@13.0.1/javax.lang.model.util.ElementScanner6.scan(ElementScanner6.java:140)
at
org.infinispan.component.processor.ComponentAnnotationProcessor.process(ComponentAnnotationProcessor.java:122)
at
jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:1023)
at
jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:939)
at
jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1267)
at
jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1381)
at
jdk.compiler/com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1263)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:935)
at
jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:104)
at
jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(JavacTaskImpl.java:147)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:100)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:94)
{noformat}
IntelliJ shows the annotation processor error first, hiding the compilation error, while
Maven only says
{noformat}
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project
infinispan-core: Fatal error compiling: CompilerException: NullPointerException
{noformat}