Answer the question
In order to leave comments, you need to log in
How to get a list of Java class methods using asm library?
I'm making a Maven plugin that obfuscates the bytecode. The problem is that if you do not run clean, then the plugin will obfuscate already obfuscated classes twice and then these classes will not be loaded by the Java machine. Obfuscation via invoke dynamic using the ClassVisitor pattern of the asm library.
I want to make a determination whether it is necessary to obfuscate the class based on the fact that the class already has a special method that occurs during obfuscation. But I can't find how to get a list of all class methods in ClassVisitor. I don’t want to use another library for preliminary analysis of the list of methods, it’s not beautiful somehow.
Is there a way to solve this via asm?
Answer the question
In order to leave comments, you need to log in
If you can load the class (via Class.forName(), for example), then you can use the getDeclaredMethod() method by wrapping the call in a try/catch and catching NoSuchMethodException if the method you're looking for isn't found. This functionality comes "out of the box" in the JDK, no additional libraries are needed.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question