A CodeVisitor CodeVisitor that generates Java bytecode instructions. Each visit method of this class appends the bytecode corresponding to the visited instruction to a byte vector, in the order these methods are called.
| 41 | */ |
| 42 | |
| 43 | public class CodeWriter implements CodeVisitor { |
| 44 | |
| 45 | /** |
| 46 | * <tt>true</tt> if preconditions must be checked at runtime or not. |
| 47 | */ |
| 48 | |
| 49 | final static boolean CHECK = false; |
| 50 | |
| 51 | /** |
| 52 | * Next code writer (see {@link ClassWriter#firstMethod firstMethod}). |
| 53 | */ |
| 54 | |
| 55 | CodeWriter next; |
| 56 | |
| 57 | /** |
| 58 | * The class writer to which this method must be added. |
| 59 | */ |
| 60 | |
| 61 | private ClassWriter cw; |
| 62 | |
| 63 | /** |
| 64 | * The constant pool item that contains the name of this method. |
| 65 | */ |
| 66 | |
| 67 | private Item name; |
| 68 | |
| 69 | /** |
| 70 | * The constant pool item that contains the descriptor of this method. |
| 71 | */ |
| 72 | |
| 73 | private Item desc; |
| 74 | |
| 75 | /** |
| 76 | * Access flags of this method. |
| 77 | */ |
| 78 | |
| 79 | private int access; |
| 80 | |
| 81 | /** |
| 82 | * Maximum stack size of this method. |
| 83 | */ |
| 84 | |
| 85 | private int maxStack; |
| 86 | |
| 87 | /** |
| 88 | * Maximum number of local variables for this method. |
| 89 | */ |
| 90 | |
| 91 | private int maxLocals; |
| 92 | |
| 93 | /** |
| 94 | * The bytecode of this method. |
| 95 | */ |
| 96 | |
| 97 | private ByteVector code = new ByteVector(); |
| 98 | |
| 99 | /** |
| 100 | * Number of entries in the catch table of this method. |
nothing calls this directly
no outgoing calls
no test coverage detected