From 444c4bac0f0ccf262375e031f717fed9edea8580 Mon Sep 17 00:00:00 2001 From: chiba Date: Fri, 11 Nov 2011 17:00:43 +0000 Subject: added javassist.bytecode.analysis.ControlFlow git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@599 30ef5769-5b8d-40dd-aea6-55b5d6557bb3 --- .../bytecode/analysis/DomTreePrinter.java | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/test/test/javassist/bytecode/analysis/DomTreePrinter.java (limited to 'src/test') diff --git a/src/test/test/javassist/bytecode/analysis/DomTreePrinter.java b/src/test/test/javassist/bytecode/analysis/DomTreePrinter.java new file mode 100644 index 00000000..f5418c50 --- /dev/null +++ b/src/test/test/javassist/bytecode/analysis/DomTreePrinter.java @@ -0,0 +1,27 @@ +package test.javassist.bytecode.analysis; + +import javassist.ClassPool; +import javassist.bytecode.analysis.ControlFlow; +import javassist.bytecode.analysis.ControlFlow.Block; + +public class DomTreePrinter { + public static void main(String[] args) throws Exception { + ClassPool pool = ClassPool.getDefault(); + ControlFlow cf = new ControlFlow(pool.get(args[0]).getDeclaredMethod(args[1])); + Block[] blocks = cf.basicBlocks(); + for (int i = 0; i < blocks.length; i++) + System.out.println(i + ": " + blocks[i]); + } + + public int dummy(int n, int[] array) { + for (int i = 0; i < n; i++) { + if (array[i] > 0) + break; + if (array[i] > -1) + continue; + array[0]++; + array[1]++; + } + return array[0]; + } +} -- cgit v1.2.3