How do I get the method body using Javassist?

删除回忆录丶 提交于 2020-08-19 06:44:26

问题


It is possible to set the method body using CtMethod.setBody(".."), but I do not find any API to get the method body in string format.


回答1:


This is not possible.

Javassist is not a decompiler. A method in a class file is represented in Java byte code. Javassist knows how to translate Java source code to byte code but not the other way round. Also, Java byte code might not even be expressable as Java source code, for example when written in a non-Java JVM language.



来源:https://stackoverflow.com/questions/29454667/how-do-i-get-the-method-body-using-javassist

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!