diff options
author | chibash <chiba@javassist.org> | 2013-12-02 12:29:03 +0900 |
---|---|---|
committer | chibash <chiba@javassist.org> | 2013-12-02 12:29:03 +0900 |
commit | 23b36218f5a07f0ecc448539807bba6b324dea8b (patch) | |
tree | 220378f3f04c5ffc70aef31b29e40d5357bbe63a /src | |
parent | 1cff20852e848e67358d609f9b52699931d8b99e (diff) | |
download | javassist-23b36218f5a07f0ecc448539807bba6b324dea8b.tar.gz javassist-23b36218f5a07f0ecc448539807bba6b324dea8b.zip |
fixed JASSIST-216
Diffstat (limited to 'src')
-rw-r--r-- | src/main/javassist/bytecode/analysis/ControlFlow.java | 8 | ||||
-rw-r--r-- | src/test/test/javassist/bytecode/analysis/DomTreeTest.java | 21 |
2 files changed, 28 insertions, 1 deletions
diff --git a/src/main/javassist/bytecode/analysis/ControlFlow.java b/src/main/javassist/bytecode/analysis/ControlFlow.java index 0560be6b..736299cb 100644 --- a/src/main/javassist/bytecode/analysis/ControlFlow.java +++ b/src/main/javassist/bytecode/analysis/ControlFlow.java @@ -86,6 +86,12 @@ public class ControlFlow { Block e = b.exit(k); e.entrances[counters[e.index]++] = b; } + + ControlFlow.Catcher[] catchers = b.catchers(); + for (int k = 0; k < catchers.length; k++) { + Block catchBlock = catchers[k].node; + catchBlock.entrances[counters[catchBlock.index]++] = b; + } } } @@ -245,7 +251,7 @@ public class ControlFlow { super.toString2(sbuf); sbuf.append(", incoming{"); for (int i = 0; i < entrances.length; i++) - sbuf.append(entrances[i].position).append(", "); + sbuf.append(entrances[i].position).append(", "); sbuf.append("}"); } diff --git a/src/test/test/javassist/bytecode/analysis/DomTreeTest.java b/src/test/test/javassist/bytecode/analysis/DomTreeTest.java index 4e277e8f..7ea54b80 100644 --- a/src/test/test/javassist/bytecode/analysis/DomTreeTest.java +++ b/src/test/test/javassist/bytecode/analysis/DomTreeTest.java @@ -89,4 +89,25 @@ public class DomTreeTest extends TestCase { return i + 3; } + + public void testDomtree3() throws Exception { + ControlFlow cf = new ControlFlow(pool.get(DomTreeTest.class.getName()).getDeclaredMethod("test3")); + Block[] blocks = cf.basicBlocks(); + for (int i = 0; i < blocks.length; i++) + System.out.println(blocks[i]); + } + + public int test3(int i, int j) { + while (i > 0) { + try { + j++; + } + catch (Throwable t) { + j = 0; + } + i--; + } + + return j; + } } |