summaryrefslogtreecommitdiffstats
path: root/src/test/test4/JIRA195.java
blob: 13b91d130b88756cefb5a4d3fff905298f638fda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package test4;

import javassist.ClassPool;
import javassist.CtClass;
import javassist.CtMethod;

public class JIRA195 {
    public int run() { return test(3); }

    public int test(int i) {
        try {}
        catch (Throwable t) {}
        finally {
            i = incByOne(i);
        }

        return i;
    }

    private int incByOne(int i) {
        return i + 1;
    }

    public static void main(String[] args) throws Exception {
        ClassPool cp = new ClassPool();
        cp.appendClassPath("./target/test-classes");
        CtClass cc = cp.get("test4.JIRA195");
        CtMethod mth = cc.getDeclaredMethod("test");
        mth.getMethodInfo().rebuildStackMap(cc.getClassPool());
    }
}