You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12345678910111213141516 |
- import javassist.*;
-
- public class Test {
- public static void main(String[] args) throws Exception {
- ClassPool cp = ClassPool.getDefault();
- // ClassPool cp = new ClassPool();
- cp.insertClassPath("./target/test-classes");
- CtClass cc = cp.get("test4.JIRA207");
- // cc.getClassFile().setMajorVersion(javassist.bytecode.ClassFile.JAVA_4);
- CtMethod cm = cc.getDeclaredMethod("foo");
- cm.insertBefore("throw new Exception();");
- CtMethod cm2 = cc.getDeclaredMethod("run2");
- cm2.insertBefore("throw new Exception();");
- cc.writeFile();
- }
- }
|