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.

DomTreePrinter.java 837B

123456789101112131415161718192021222324252627
  1. package test.javassist.bytecode.analysis;
  2. import javassist.ClassPool;
  3. import javassist.bytecode.analysis.ControlFlow;
  4. import javassist.bytecode.analysis.ControlFlow.Block;
  5. public class DomTreePrinter {
  6. public static void main(String[] args) throws Exception {
  7. ClassPool pool = ClassPool.getDefault();
  8. ControlFlow cf = new ControlFlow(pool.get(args[0]).getDeclaredMethod(args[1]));
  9. Block[] blocks = cf.basicBlocks();
  10. for (int i = 0; i < blocks.length; i++)
  11. System.out.println(i + ": " + blocks[i]);
  12. }
  13. public int dummy(int n, int[] array) {
  14. for (int i = 0; i < n; i++) {
  15. if (array[i] > 0)
  16. break;
  17. if (array[i] > -1)
  18. continue;
  19. array[0]++;
  20. array[1]++;
  21. }
  22. return array[0];
  23. }
  24. }