• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package test4;
2 
3 import javassist.ClassPool;
4 import javassist.CtClass;
5 import javassist.CtMethod;
6 
7 public class JIRA195 {
run()8     public int run() { return test(3); }
9 
test(int i)10     public int test(int i) {
11         try {}
12         catch (Throwable t) {}
13         finally {
14             i = incByOne(i);
15         }
16 
17         return i;
18     }
19 
incByOne(int i)20     private int incByOne(int i) {
21         return i + 1;
22     }
23 
main(String[] args)24     public static void main(String[] args) throws Exception {
25         ClassPool cp = new ClassPool();
26         cp.appendClassPath("./target/test-classes");
27         CtClass cc = cp.get("test4.JIRA195");
28         CtMethod mth = cc.getDeclaredMethod("test");
29         mth.getMethodInfo().rebuildStackMap(cc.getClassPool());
30     }
31 }
32