Skip to content
This repository has been archived by the owner on Oct 10, 2024. It is now read-only.

MirroredTypesException on AnnotationSpec#get(Annotation) #978

Open
dansiviter opened this issue Jul 15, 2023 · 0 comments
Open

MirroredTypesException on AnnotationSpec#get(Annotation) #978

dansiviter opened this issue Jul 15, 2023 · 0 comments

Comments

@dansiviter
Copy link

When using AnnotationSpec#get(Annotation) and the annotation contains Class types, the following occurs (using @jakarta.transaction.Transactional:

java.lang.RuntimeException: java.lang.RuntimeException: Reflecting @jakarta.transaction.Transactional(dontRollbackOn={}, rollbackOn={}, value=REQUIRED) failed!
        at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.invocationHelper(JavacTaskImpl.java:168)
        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)
        ...
Caused by: java.lang.RuntimeException: Reflecting @jakarta.transaction.Transactional(dontRollbackOn={}, rollbackOn={}, value=REQUIRED) failed!
        at com.squareup.javapoet.AnnotationSpec.get(AnnotationSpec.java:137)
        at com.squareup.javapoet.AnnotationSpec.get(AnnotationSpec.java:109)
        ...
        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:1382)
        at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1234)
        at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:916)
        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)
        ... 16 more
Caused by: java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at com.squareup.javapoet.AnnotationSpec.get(AnnotationSpec.java:118)
        ... 48 more
Caused by: javax.lang.model.type.MirroredTypesException: Attempt to access Class objects for TypeMirrors []
        at jdk.compiler/com.sun.tools.javac.model.AnnotationProxyMaker$MirroredTypesExceptionProxy.generateException(AnnotationProxyMaker.java:355)
        at java.base/sun.reflect.annotation.AnnotationInvocationHandler.invoke(AnnotationInvocationHandler.java:89)
        at jdk.proxy2/jdk.proxy2.$Proxy48.dontRollbackOn(Unknown Source)
        ... 53 more

The issue is documented here.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant