I would like to get a String like:
Ljava/lang/Class;.getName()Ljava/lang/String;
(JNI style type/method description, or called type descriptor)
from an javax.lang.model.type.TypeMirror
object in an AnnotationProcessor
. Is there any Convenience method or library, which parses the TypeMirror
object and produces a String like above?
I would like to use the String to construct a
org.objectweb.asm.Type
object from the type descriptor string.
I realize this is nearly a decade old, but I've written a library to add TypeMirror/Element support to the ASM library. See here: https://github.com/soabase/asm-mirror-descriptor - with this library you can now do:
MirrorClassReader reader = new MirrorClassReader(processingEnv, element);
reader.accept(myClassVisitor); // standard ASM ClassVisitor
or
String signature = SignatureMirrorType.getSignature(processingEnv, element);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With