Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试在 java 类文件中找到类初始值设定项。我可以找到方法没问题,但是如果在类文件中找不到 main,那么我希望它找到类初始化程序并在那里注入代码。
如何使用 Javassist 找到类的初始化程序?
一个类的类初始化块被编译成一个名为<clinit>. 尖括号是名称的一部分,因此 Java 代码无法访问它,但它或多或少是一个普通的静态方法。
<clinit>