46 *
47 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
48 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
49 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
50 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
51 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
52 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
53 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
54 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
55 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
56 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
57 * THE POSSIBILITY OF SUCH DAMAGE.
58 */
59 package jdk.internal.org.objectweb.asm;
60
61 /**
62 * A visitor to visit a Java method. The methods of this class must be
63 * called in the following order: [ <tt>visitAnnotationDefault</tt> ] (
64 * <tt>visitAnnotation</tt> | <tt>visitParameterAnnotation</tt> |
65 * <tt>visitAttribute</tt> )* [ <tt>visitCode</tt> ( <tt>visitFrame</tt> |
66 * <tt>visit</tt><i>X</i>Insn</tt> | <tt>visitLabel</tt> | <tt>visitTryCatchBlock</tt> |
67 * <tt>visitLocalVariable</tt> | <tt>visitLineNumber</tt> )* <tt>visitMaxs</tt> ]
68 * <tt>visitEnd</tt>. In addition, the <tt>visit</tt><i>X</i>Insn</tt>
69 * and <tt>visitLabel</tt> methods must be called in the sequential order of
70 * the bytecode instructions of the visited code, <tt>visitTryCatchBlock</tt>
71 * must be called <i>before</i> the labels passed as arguments have been
72 * visited, and the <tt>visitLocalVariable</tt> and <tt>visitLineNumber</tt>
73 * methods must be called <i>after</i> the labels passed as arguments have been
74 * visited.
75 *
76 * @author Eric Bruneton
77 */
78 public abstract class MethodVisitor {
79
80 /**
81 * The ASM API version implemented by this visitor. The value of this field
82 * must be one of {@link Opcodes#ASM4}.
83 */
84 protected final int api;
85
86 /**
87 * The method visitor to which this visitor must delegate method calls. May
88 * be null.
199 * starts an exception handler block. The visited types must describe the
200 * values of the local variables and of the operand stack elements <i>just
201 * before</i> <b>i</b> is executed. <br> <br> (*) this is mandatory only
202 * for classes whose version is greater than or equal to
203 * {@link Opcodes#V1_6 V1_6}. <br> <br> Packed frames are basically
204 * "deltas" from the state of the previous frame (very first frame is
205 * implicitly defined by the method's parameters and access flags): <ul>
206 * <li>{@link Opcodes#F_SAME} representing frame with exactly the same
207 * locals as the previous frame and with the empty stack.</li> <li>{@link Opcodes#F_SAME1}
208 * representing frame with exactly the same locals as the previous frame and
209 * with single value on the stack (<code>nStack</code> is 1 and
210 * <code>stack[0]</code> contains value for the type of the stack item).</li>
211 * <li>{@link Opcodes#F_APPEND} representing frame with current locals are
212 * the same as the locals in the previous frame, except that additional
213 * locals are defined (<code>nLocal</code> is 1, 2 or 3 and
214 * <code>local</code> elements contains values representing added types).</li>
215 * <li>{@link Opcodes#F_CHOP} representing frame with current locals are
216 * the same as the locals in the previous frame, except that the last 1-3
217 * locals are absent and with the empty stack (<code>nLocals</code> is 1,
218 * 2 or 3). </li> <li>{@link Opcodes#F_FULL} representing complete frame
219 * data.</li> </li> </ul>
220 *
221 * @param type the type of this stack map frame. Must be
222 * {@link Opcodes#F_NEW} for expanded frames, or
223 * {@link Opcodes#F_FULL}, {@link Opcodes#F_APPEND},
224 * {@link Opcodes#F_CHOP}, {@link Opcodes#F_SAME} or
225 * {@link Opcodes#F_APPEND}, {@link Opcodes#F_SAME1} for compressed
226 * frames.
227 * @param nLocal the number of local variables in the visited frame.
228 * @param local the local variable types in this frame. This array must not
229 * be modified. Primitive types are represented by
230 * {@link Opcodes#TOP}, {@link Opcodes#INTEGER},
231 * {@link Opcodes#FLOAT}, {@link Opcodes#LONG},
232 * {@link Opcodes#DOUBLE},{@link Opcodes#NULL} or
233 * {@link Opcodes#UNINITIALIZED_THIS} (long and double are
234 * represented by a single element). Reference types are represented
235 * by String objects (representing internal names), and uninitialized
236 * types by Label objects (this label designates the NEW instruction
237 * that created this uninitialized value).
238 * @param nStack the number of operand stack elements in the visited frame.
239 * @param stack the operand stack types in this frame. This array must not
|
46 *
47 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
48 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
49 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
50 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
51 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
52 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
53 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
54 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
55 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
56 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
57 * THE POSSIBILITY OF SUCH DAMAGE.
58 */
59 package jdk.internal.org.objectweb.asm;
60
61 /**
62 * A visitor to visit a Java method. The methods of this class must be
63 * called in the following order: [ <tt>visitAnnotationDefault</tt> ] (
64 * <tt>visitAnnotation</tt> | <tt>visitParameterAnnotation</tt> |
65 * <tt>visitAttribute</tt> )* [ <tt>visitCode</tt> ( <tt>visitFrame</tt> |
66 * <tt>visit<i>X</i>Insn</tt> | <tt>visitLabel</tt> | <tt>visitTryCatchBlock</tt> |
67 * <tt>visitLocalVariable</tt> | <tt>visitLineNumber</tt> )* <tt>visitMaxs</tt> ]
68 * <tt>visitEnd</tt>. In addition, the <tt>visit<i>X</i>Insn</tt>
69 * and <tt>visitLabel</tt> methods must be called in the sequential order of
70 * the bytecode instructions of the visited code, <tt>visitTryCatchBlock</tt>
71 * must be called <i>before</i> the labels passed as arguments have been
72 * visited, and the <tt>visitLocalVariable</tt> and <tt>visitLineNumber</tt>
73 * methods must be called <i>after</i> the labels passed as arguments have been
74 * visited.
75 *
76 * @author Eric Bruneton
77 */
78 public abstract class MethodVisitor {
79
80 /**
81 * The ASM API version implemented by this visitor. The value of this field
82 * must be one of {@link Opcodes#ASM4}.
83 */
84 protected final int api;
85
86 /**
87 * The method visitor to which this visitor must delegate method calls. May
88 * be null.
199 * starts an exception handler block. The visited types must describe the
200 * values of the local variables and of the operand stack elements <i>just
201 * before</i> <b>i</b> is executed. <br> <br> (*) this is mandatory only
202 * for classes whose version is greater than or equal to
203 * {@link Opcodes#V1_6 V1_6}. <br> <br> Packed frames are basically
204 * "deltas" from the state of the previous frame (very first frame is
205 * implicitly defined by the method's parameters and access flags): <ul>
206 * <li>{@link Opcodes#F_SAME} representing frame with exactly the same
207 * locals as the previous frame and with the empty stack.</li> <li>{@link Opcodes#F_SAME1}
208 * representing frame with exactly the same locals as the previous frame and
209 * with single value on the stack (<code>nStack</code> is 1 and
210 * <code>stack[0]</code> contains value for the type of the stack item).</li>
211 * <li>{@link Opcodes#F_APPEND} representing frame with current locals are
212 * the same as the locals in the previous frame, except that additional
213 * locals are defined (<code>nLocal</code> is 1, 2 or 3 and
214 * <code>local</code> elements contains values representing added types).</li>
215 * <li>{@link Opcodes#F_CHOP} representing frame with current locals are
216 * the same as the locals in the previous frame, except that the last 1-3
217 * locals are absent and with the empty stack (<code>nLocals</code> is 1,
218 * 2 or 3). </li> <li>{@link Opcodes#F_FULL} representing complete frame
219 * data.</li> </ul>
220 *
221 * @param type the type of this stack map frame. Must be
222 * {@link Opcodes#F_NEW} for expanded frames, or
223 * {@link Opcodes#F_FULL}, {@link Opcodes#F_APPEND},
224 * {@link Opcodes#F_CHOP}, {@link Opcodes#F_SAME} or
225 * {@link Opcodes#F_APPEND}, {@link Opcodes#F_SAME1} for compressed
226 * frames.
227 * @param nLocal the number of local variables in the visited frame.
228 * @param local the local variable types in this frame. This array must not
229 * be modified. Primitive types are represented by
230 * {@link Opcodes#TOP}, {@link Opcodes#INTEGER},
231 * {@link Opcodes#FLOAT}, {@link Opcodes#LONG},
232 * {@link Opcodes#DOUBLE},{@link Opcodes#NULL} or
233 * {@link Opcodes#UNINITIALIZED_THIS} (long and double are
234 * represented by a single element). Reference types are represented
235 * by String objects (representing internal names), and uninitialized
236 * types by Label objects (this label designates the NEW instruction
237 * that created this uninitialized value).
238 * @param nStack the number of operand stack elements in the visited frame.
239 * @param stack the operand stack types in this frame. This array must not
|