How to get the body of a method using a Javassist?

You can set the method body using CtMethod.setBody("..") , but I do not find an API to get the method body in string format.

+5
source share
1 answer

It's impossible.

Javassist is not a decompiler. The method in the class file is represented in Java bytecode. Javassist knows how to translate Java source code into byte code, but not vice versa. In addition, Java bytecode may not even be expressed as Java source code, for example when written in Java Java.

+5
source

All Articles