Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-11675

ComponentAnnotationProcessor exception hides compilation error

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 11.0.0.Dev04, 10.1.6.Final
    • Fix Version/s: 11.0.0.Dev05
    • Component/s: Build, Core
    • Labels:
      None

      Description

      When a source file has a component annotation with an invalid value, e.g. @DefaultFactoryFor(classes = {NonExistentClass.class}), ComponentAnnotationProcessor hits a ClassCastException:

      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)
      

      IntelliJ shows the annotation processor error first, hiding the compilation error, while Maven only says

      [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
      

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                dan.berindei Dan Berindei
                Reporter:
                dan.berindei Dan Berindei
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: