View Javadoc
1   package mockit.asm.controlFlow;
2   
3   import edu.umd.cs.findbugs.annotations.NonNull;
4   
5   /**
6    * An edge in the control flow graph of a method body. See {@link Label}.
7    */
8   public final class Edge {
9       /**
10       * Denotes a normal control flow graph edge.
11       */
12      static final int NORMAL = 0;
13  
14      /**
15       * Denotes a control flow graph edge corresponding to an exception handler. More precisely any {@link Edge} whose
16       * {@link #info} is strictly positive corresponds to an exception handler. The actual value of {@link #info} is the
17       * index, in the type table of the classfile being written, of the exception that is caught.
18       */
19      public static final int EXCEPTION = 0x7FFFFFFF;
20  
21      /**
22       * Information about this control flow graph edge. For classfiles older than 1.7, this field is the (relative) stack
23       * size in the basic block from which this edge originates. This size is equal to the stack size at the "jump"
24       * instruction to which this edge corresponds, relatively to the stack size at the beginning of the originating
25       * basic block. For 1.7+ classfiles, this field is the kind of this control flow graph edge (i.e. NORMAL or
26       * EXCEPTION).
27       */
28      final int info;
29  
30      /**
31       * The successor block of the basic block from which this edge originates.
32       */
33      final Label successor;
34  
35      /**
36       * The next edge in the list of successors of the originating basic block. See {@link Label#successors}.
37       */
38      Edge next;
39  
40      public Edge(int info, @NonNull Label successor) {
41          this.info = info;
42          this.successor = successor;
43      }
44  
45      /**
46       * Sets the {@link #next} edge.
47       */
48      public void setNext(Edge next) {
49          this.next = next;
50      }
51  }