javassist
kong-kong
记录流水账
展开
-
javassist文档
1. 读写字节码 我们知道 Java 字节码以二进制的形式存储在 class 文件中,每一个 class 文件包含一个 Java 类或接口。Javaassist 就是一个用来处理 Java 字节码的类库。 在 Javassist 中,类Javaassit.CtClass表示 class 文件。一个 GtClass (编译时类)对象可以处理一个 class 文件,下面是一个简单的例子:...转载 2019-05-10 15:35:00 · 511 阅读 · 0 评论 -
javassist doc page 1
http://www.javassist.org/tutorial/tutorial.html 1. Reading and writing bytecode Javassist is a class library for dealing with Java bytecode. Java bytecode is stored in a binary file called a cl...原创 2019-05-11 06:49:55 · 356 阅读 · 0 评论 -
javassist doc page2
CtClassprovides methods for introspection. The introspective ability of Javassist is compatible with that of the Java reflection API.CtClassprovidesgetName(),getSuperclass(),getMethods(), and s...原创 2019-05-11 06:51:28 · 441 阅读 · 0 评论 -
javassist doc page3
5. Bytecode level API Javassist also provides lower-level API for directly editing a class file. To use this level of API, you need detailed knowledge of the Java bytecode and the class file format...原创 2019-05-11 06:52:58 · 392 阅读 · 0 评论 -
javassist frozen classes
Frozen classes If a CtClass object is converted into a class file by writeFile(), toClass(), or toBytecode(), Javassist freezes that CtClass object. Further modifications of that CtClass object are n...翻译 2019-05-11 07:39:32 · 2066 阅读 · 0 评论 -
insertBefore example
public class Point { int x, y; void move(int dx, int dy) { x += dx; y += dy; } } public static void main(String[] args) throws Exception{ ClassPool pool = ClassPool.getDefault()...原创 2019-05-12 09:00:28 · 303 阅读 · 0 评论 -
addCatch example
官方文档 addCatch() inserts a code fragment into a method body so that the code fragment is executed when the method body throws an exception and the control returns to the caller. In the source text...原创 2019-05-12 20:25:53 · 488 阅读 · 0 评论