-
Notifications
You must be signed in to change notification settings - Fork 3
Closed
Description
I have not tested this issue thoroughly.
For me, I was using an inner-class annotation, take this sloppy example:
// Example.java ============================================
package org.example;
@interface Example {
@interface Whatever {
}
}
// package-info.java ========================================
@GeneratePrisms({
// among other prisms...
@GeneratePrism(name = "ExampleWhateverPrism", value = Example.Whatever.class)
})
package org.example;If you now comment out the Whatever class, so it does not exist, and the reference in the package-info is invalid.
You are presented with a non-descriptive error. Take the following stacktrace, which I shortened, using mvnd package -e:
Fatal error compiling
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2(MojoExecutor.java:375)
at org.apache.maven.lifecycle.internal................
at org.mvndaemon.mvnd.builder..............
at java.base/java.util.concurrent..............
at java.base/java.lang.Thread.............
Caused by: org.apache.maven.plugin.MojoExecutionException: Fatal error compiling
at org.apache.maven......................
... 12 common frames omitted
Caused by: org.codehaus.plexus.compiler.CompilerException: java.lang.NullPointerException: Cannot invoke "javax.lang.model.type.TypeMirror.getKind()" because "t" is null
at org.codehaus.plexus..............
... 16 common frames omitted
Caused by: java.lang.RuntimeException: java.lang.NullPointerException: Cannot invoke "javax.lang.model.type.TypeMirror.getKind()" because "t" is null
at jdk.compiler..................
... 18 common frames omitted
Caused by: java.lang.NullPointerException: Cannot invoke "javax.lang.model.type.TypeMirror.getKind()" because "t" is null
at jdk.compiler/com.sun.tools.javac.model.JavacTypes.asElement(JavacTypes.java:75)
at io.avaje.prism.internal.APContext.asTypeElement(APContext.java:235)
at io.avaje.prism.internal.Util.isMeta(Util.java:15)
at io.avaje.prism.internal.PrismGenerator.generatePrism(PrismGenerator.java:352)
at io.avaje.prism.internal.PrismGenerator.generateIfNew(PrismGenerator.java:314)
at io.avaje.prism.internal.PrismGenerator.process(PrismGenerator.java:258)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:1021)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:937)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1265)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1380)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1271)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:948)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:104)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.invocationHelper(JavacTaskImpl.java:152)
... 21 common frames omitted
If not using -e, you simply get Cannot invoke "javax.lang.model.type.TypeMirror.getKind()" because "t" is null.
... which is true, since the class doesn't exist.
Metadata
Metadata
Assignees
Labels
No labels