Another ridiculous way to get the java.lang.reflect.Method inclusion method:
void someMethod() { class A{} Method thisMethod = A.class.getEnclosingMethod(); }
Thus, you can not only find the method name, but also other interesting functions of the method, such as annotations, parameterized types, etc.
I would like to have a more built-in way to get metadata at runtime ...
source share