How to get type of type descriptor (JNI style) String from a TypeMirror object (annotation processing)

I would like to get a string like:

Ljava/lang/Class;.getName()Ljava/lang/String; 

(JNI style type / method description or type descriptor)

from javax.lang.model.type.TypeMirror object to AnnotationProcessor . Is there a Convenience method or library that parses a TypeMirror object and creates a string as above?

I would like to use String to build an org.objectweb.asm.Type object from a type descriptor string.

+4
source share
1 answer

Open the console, navigate to the already compiled fe classes: cd./build/classes. Then enter javap -s NameOfYourCompiledClass.class (in the console) and you will get your descriptors. For your situation, I would extend this TypeMirror class with my custom class, overload all methods, compile the project, and follow the instructions for your new class

-1
source

Source: https://habr.com/ru/post/1436990/


All Articles