1 /*
   2  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   3  *
   4  * This code is free software; you can redistribute it and/or modify it
   5  * under the terms of the GNU General Public License version 2 only, as
   6  * published by the Free Software Foundation.  Oracle designates this
   7  * particular file as subject to the "Classpath" exception as provided
   8  * by Oracle in the LICENSE file that accompanied this code.
   9  *
  10  * This code is distributed in the hope that it will be useful, but WITHOUT
  11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  */
  24 
  25 /*
  26  * This file is available under and governed by the GNU General Public
  27  * License version 2 only, as published by the Free Software Foundation.
  28  * However, the following notice accompanied the original version of this
  29  * file:
  30  *
  31  * ASM: a very small and fast Java bytecode manipulation framework
  32  * Copyright (c) 2000-2011 INRIA, France Telecom
  33  * All rights reserved.
  34  *
  35  * Redistribution and use in source and binary forms, with or without
  36  * modification, are permitted provided that the following conditions
  37  * are met:
  38  * 1. Redistributions of source code must retain the above copyright
  39  *    notice, this list of conditions and the following disclaimer.
  40  * 2. Redistributions in binary form must reproduce the above copyright
  41  *    notice, this list of conditions and the following disclaimer in the
  42  *    documentation and/or other materials provided with the distribution.
  43  * 3. Neither the name of the copyright holders nor the names of its
  44  *    contributors may be used to endorse or promote products derived from
  45  *    this software without specific prior written permission.
  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.
  89      */
  90     protected MethodVisitor mv;
  91 
  92     /**
  93      * Constructs a new {@link MethodVisitor}.
  94      *
  95      * @param api the ASM API version implemented by this visitor. Must be one
  96      *        of {@link Opcodes#ASM4}.
  97      */
  98     public MethodVisitor(final int api) {
  99         this(api, null);
 100     }
 101 
 102     /**
 103      * Constructs a new {@link MethodVisitor}.
 104      *
 105      * @param api the ASM API version implemented by this visitor. Must be one
 106      *        of {@link Opcodes#ASM4}.
 107      * @param mv the method visitor to which this visitor must delegate method
 108      *        calls. May be null.
 109      */
 110     public MethodVisitor(final int api, final MethodVisitor mv) {
 111         /*if (api != Opcodes.ASM4) {
 112             throw new IllegalArgumentException();
 113         }*/
 114         this.api = api;
 115         this.mv = mv;
 116     }
 117 
 118     // -------------------------------------------------------------------------
 119     // Annotations and non standard attributes
 120     // -------------------------------------------------------------------------
 121 
 122     /**
 123      * Visits the default value of this annotation interface method.
 124      *
 125      * @return a visitor to the visit the actual default value of this
 126      *         annotation interface method, or <tt>null</tt> if this visitor
 127      *         is not interested in visiting this default value. The 'name'
 128      *         parameters passed to the methods of this annotation visitor are
 129      *         ignored. Moreover, exacly one visit method must be called on this
 130      *         annotation visitor, followed by visitEnd.
 131      */
 132     public AnnotationVisitor visitAnnotationDefault() {
 133         if (mv != null) {
 134             return mv.visitAnnotationDefault();
 135         }
 136         return null;
 137     }
 138 
 139     /**
 140      * Visits an annotation of this method.
 141      *
 142      * @param desc the class descriptor of the annotation class.
 143      * @param visible <tt>true</tt> if the annotation is visible at runtime.
 144      * @return a visitor to visit the annotation values, or <tt>null</tt> if
 145      *         this visitor is not interested in visiting this annotation.
 146      */
 147     public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
 148         if (mv != null) {
 149             return mv.visitAnnotation(desc, visible);
 150         }
 151         return null;
 152     }
 153 
 154     /**
 155      * Visits an annotation of a parameter this method.
 156      *
 157      * @param parameter the parameter index.
 158      * @param desc the class descriptor of the annotation class.
 159      * @param visible <tt>true</tt> if the annotation is visible at runtime.
 160      * @return a visitor to visit the annotation values, or <tt>null</tt> if
 161      *         this visitor is not interested in visiting this annotation.
 162      */
 163     public AnnotationVisitor visitParameterAnnotation(
 164         int parameter,
 165         String desc,
 166         boolean visible)
 167     {
 168         if (mv != null) {
 169             return mv.visitParameterAnnotation(parameter, desc, visible);
 170         }
 171         return null;
 172     }
 173 
 174     /**
 175      * Visits a non standard attribute of this method.
 176      *
 177      * @param attr an attribute.
 178      */
 179     public void visitAttribute(Attribute attr) {
 180         if (mv != null) {
 181             mv.visitAttribute(attr);
 182         }
 183     }
 184 
 185     /**
 186      * Starts the visit of the method's code, if any (i.e. non abstract method).
 187      */
 188     public void visitCode() {
 189         if (mv != null) {
 190             mv.visitCode();
 191         }
 192     }
 193 
 194     /**
 195      * Visits the current state of the local variables and operand stack
 196      * elements. This method must(*) be called <i>just before</i> any
 197      * instruction <b>i</b> that follows an unconditional branch instruction
 198      * such as GOTO or THROW, that is the target of a jump instruction, or that
 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
 240      *        be modified. Its content has the same format as the "local" array.
 241      * @throws IllegalStateException if a frame is visited just after another
 242      *        one, without any instruction between the two (unless this frame
 243      *        is a Opcodes#F_SAME frame, in which case it is silently ignored).
 244      */
 245     public void visitFrame(
 246         int type,
 247         int nLocal,
 248         Object[] local,
 249         int nStack,
 250         Object[] stack)
 251     {
 252         if (mv != null) {
 253             mv.visitFrame(type, nLocal, local, nStack, stack);
 254         }
 255     }
 256 
 257     // -------------------------------------------------------------------------
 258     // Normal instructions
 259     // -------------------------------------------------------------------------
 260 
 261     /**
 262      * Visits a zero operand instruction.
 263      *
 264      * @param opcode the opcode of the instruction to be visited. This opcode is
 265      *        either NOP, ACONST_NULL, ICONST_M1, ICONST_0, ICONST_1, ICONST_2,
 266      *        ICONST_3, ICONST_4, ICONST_5, LCONST_0, LCONST_1, FCONST_0,
 267      *        FCONST_1, FCONST_2, DCONST_0, DCONST_1, IALOAD, LALOAD, FALOAD,
 268      *        DALOAD, AALOAD, BALOAD, CALOAD, SALOAD, IASTORE, LASTORE, FASTORE,
 269      *        DASTORE, AASTORE, BASTORE, CASTORE, SASTORE, POP, POP2, DUP,
 270      *        DUP_X1, DUP_X2, DUP2, DUP2_X1, DUP2_X2, SWAP, IADD, LADD, FADD,
 271      *        DADD, ISUB, LSUB, FSUB, DSUB, IMUL, LMUL, FMUL, DMUL, IDIV, LDIV,
 272      *        FDIV, DDIV, IREM, LREM, FREM, DREM, INEG, LNEG, FNEG, DNEG, ISHL,
 273      *        LSHL, ISHR, LSHR, IUSHR, LUSHR, IAND, LAND, IOR, LOR, IXOR, LXOR,
 274      *        I2L, I2F, I2D, L2I, L2F, L2D, F2I, F2L, F2D, D2I, D2L, D2F, I2B,
 275      *        I2C, I2S, LCMP, FCMPL, FCMPG, DCMPL, DCMPG, IRETURN, LRETURN,
 276      *        FRETURN, DRETURN, ARETURN, RETURN, ARRAYLENGTH, ATHROW,
 277      *        MONITORENTER, or MONITOREXIT.
 278      */
 279     public void visitInsn(int opcode) {
 280         if (mv != null) {
 281             mv.visitInsn(opcode);
 282         }
 283     }
 284 
 285     /**
 286      * Visits an instruction with a single int operand.
 287      *
 288      * @param opcode the opcode of the instruction to be visited. This opcode is
 289      *        either BIPUSH, SIPUSH or NEWARRAY.
 290      * @param operand the operand of the instruction to be visited.<br> When
 291      *        opcode is BIPUSH, operand value should be between Byte.MIN_VALUE
 292      *        and Byte.MAX_VALUE.<br> When opcode is SIPUSH, operand value
 293      *        should be between Short.MIN_VALUE and Short.MAX_VALUE.<br> When
 294      *        opcode is NEWARRAY, operand value should be one of
 295      *        {@link Opcodes#T_BOOLEAN}, {@link Opcodes#T_CHAR},
 296      *        {@link Opcodes#T_FLOAT}, {@link Opcodes#T_DOUBLE},
 297      *        {@link Opcodes#T_BYTE}, {@link Opcodes#T_SHORT},
 298      *        {@link Opcodes#T_INT} or {@link Opcodes#T_LONG}.
 299      */
 300     public void visitIntInsn(int opcode, int operand) {
 301         if (mv != null) {
 302             mv.visitIntInsn(opcode, operand);
 303         }
 304     }
 305 
 306     /**
 307      * Visits a local variable instruction. A local variable instruction is an
 308      * instruction that loads or stores the value of a local variable.
 309      *
 310      * @param opcode the opcode of the local variable instruction to be visited.
 311      *        This opcode is either ILOAD, LLOAD, FLOAD, DLOAD, ALOAD, ISTORE,
 312      *        LSTORE, FSTORE, DSTORE, ASTORE or RET.
 313      * @param var the operand of the instruction to be visited. This operand is
 314      *        the index of a local variable.
 315      */
 316     public void visitVarInsn(int opcode, int var) {
 317         if (mv != null) {
 318             mv.visitVarInsn(opcode, var);
 319         }
 320     }
 321 
 322     /**
 323      * Visits a type instruction. A type instruction is an instruction that
 324      * takes the internal name of a class as parameter.
 325      *
 326      * @param opcode the opcode of the type instruction to be visited. This
 327      *        opcode is either NEW, ANEWARRAY, CHECKCAST or INSTANCEOF.
 328      * @param type the operand of the instruction to be visited. This operand
 329      *        must be the internal name of an object or array class (see {@link
 330      *        Type#getInternalName() getInternalName}).
 331      */
 332     public void visitTypeInsn(int opcode, String type) {
 333         if (mv != null) {
 334             mv.visitTypeInsn(opcode, type);
 335         }
 336     }
 337 
 338     /**
 339      * Visits a field instruction. A field instruction is an instruction that
 340      * loads or stores the value of a field of an object.
 341      *
 342      * @param opcode the opcode of the type instruction to be visited. This
 343      *        opcode is either GETSTATIC, PUTSTATIC, GETFIELD or PUTFIELD.
 344      * @param owner the internal name of the field's owner class (see {@link
 345      *        Type#getInternalName() getInternalName}).
 346      * @param name the field's name.
 347      * @param desc the field's descriptor (see {@link Type Type}).
 348      */
 349     public void visitFieldInsn(int opcode, String owner, String name, String desc) {
 350         if (mv != null) {
 351             mv.visitFieldInsn(opcode, owner, name, desc);
 352         }
 353     }
 354 
 355     /**
 356      * Visits a method instruction. A method instruction is an instruction that
 357      * invokes a method.
 358      *
 359      * @param opcode the opcode of the type instruction to be visited. This
 360      *        opcode is either INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC
 361      *        or INVOKEINTERFACE.
 362      * @param owner the internal name of the method's owner class (see {@link
 363      *        Type#getInternalName() getInternalName}).
 364      * @param name the method's name.
 365      * @param desc the method's descriptor (see {@link Type Type}).
 366      */
 367     public void visitMethodInsn(int opcode, String owner, String name, String desc) {
 368         if (mv != null) {
 369             mv.visitMethodInsn(opcode, owner, name, desc);
 370         }
 371     }
 372 
 373     /**
 374      * Visits an invokedynamic instruction.
 375      *
 376      * @param name the method's name.
 377      * @param desc the method's descriptor (see {@link Type Type}).
 378      * @param bsm the bootstrap method.
 379      * @param bsmArgs the bootstrap method constant arguments. Each argument
 380      *        must be an {@link Integer}, {@link Float}, {@link Long},
 381      *        {@link Double}, {@link String}, {@link Type} or {@link Handle}
 382      *        value. This method is allowed to modify the content of the array
 383      *        so a caller should expect that this array may change.
 384      */
 385     public void visitInvokeDynamicInsn(String name, String desc, Handle bsm, Object... bsmArgs) {
 386         if (mv != null) {
 387             mv.visitInvokeDynamicInsn(name, desc, bsm, bsmArgs);
 388         }
 389     }
 390 
 391     /**
 392      * Visits a jump instruction. A jump instruction is an instruction that may
 393      * jump to another instruction.
 394      *
 395      * @param opcode the opcode of the type instruction to be visited. This
 396      *        opcode is either IFEQ, IFNE, IFLT, IFGE, IFGT, IFLE, IF_ICMPEQ,
 397      *        IF_ICMPNE, IF_ICMPLT, IF_ICMPGE, IF_ICMPGT, IF_ICMPLE, IF_ACMPEQ,
 398      *        IF_ACMPNE, GOTO, JSR, IFNULL or IFNONNULL.
 399      * @param label the operand of the instruction to be visited. This operand
 400      *        is a label that designates the instruction to which the jump
 401      *        instruction may jump.
 402      */
 403     public void visitJumpInsn(int opcode, Label label) {
 404         if (mv != null) {
 405             mv.visitJumpInsn(opcode, label);
 406         }
 407     }
 408 
 409     /**
 410      * Visits a label. A label designates the instruction that will be visited
 411      * just after it.
 412      *
 413      * @param label a {@link Label Label} object.
 414      */
 415     public void visitLabel(Label label) {
 416         if (mv != null) {
 417             mv.visitLabel(label);
 418         }
 419     }
 420 
 421     // -------------------------------------------------------------------------
 422     // Special instructions
 423     // -------------------------------------------------------------------------
 424 
 425     /**
 426      * Visits a LDC instruction. Note that new constant types may be added in
 427      * future versions of the Java Virtual Machine. To easily detect new
 428      * constant types, implementations of this method should check for
 429      * unexpected constant types, like this:
 430      * <pre>
 431      * if (cst instanceof Integer) {
 432      *   // ...
 433      * } else if (cst instanceof Float) {
 434      *   // ...
 435      * } else if (cst instanceof Long) {
 436      *   // ...
 437      * } else if (cst instanceof Double) {
 438      *   // ...
 439      * } else if (cst instanceof String) {
 440      *   // ...
 441      * } else if (cst instanceof Type) {
 442      *   int sort = ((Type) cst).getSort();
 443      *   if (sort == Type.OBJECT) {
 444      *     // ...
 445      *   } else if (sort == Type.ARRAY) {
 446      *     // ...
 447      *   } else if (sort == Type.METHOD) {
 448      *     // ...
 449      *   } else {
 450      *     // throw an exception
 451      *   }
 452      * } else if (cst instanceof Handle) {
 453      *   // ...
 454      * } else {
 455      *   // throw an exception
 456      * }</pre>
 457      *
 458      * @param cst the constant to be loaded on the stack. This parameter must be
 459      *        a non null {@link Integer}, a {@link Float}, a {@link Long}, a
 460      *        {@link Double}, a {@link String}, a {@link Type} of OBJECT or ARRAY
 461      *        sort for <tt>.class</tt> constants, for classes whose version is
 462      *        49.0, a {@link Type} of METHOD sort or a {@link Handle} for
 463      *        MethodType and MethodHandle constants, for classes whose version
 464      *        is 51.0.
 465      */
 466     public void visitLdcInsn(Object cst) {
 467         if (mv != null) {
 468             mv.visitLdcInsn(cst);
 469         }
 470     }
 471 
 472     /**
 473      * Visits an IINC instruction.
 474      *
 475      * @param var index of the local variable to be incremented.
 476      * @param increment amount to increment the local variable by.
 477      */
 478     public void visitIincInsn(int var, int increment) {
 479         if (mv != null) {
 480             mv.visitIincInsn(var, increment);
 481         }
 482     }
 483 
 484     /**
 485      * Visits a TABLESWITCH instruction.
 486      *
 487      * @param min the minimum key value.
 488      * @param max the maximum key value.
 489      * @param dflt beginning of the default handler block.
 490      * @param labels beginnings of the handler blocks. <tt>labels[i]</tt> is
 491      *        the beginning of the handler block for the <tt>min + i</tt> key.
 492      */
 493     public void visitTableSwitchInsn(int min, int max, Label dflt, Label... labels) {
 494         if (mv != null) {
 495             mv.visitTableSwitchInsn(min, max, dflt, labels);
 496         }
 497     }
 498 
 499     /**
 500      * Visits a LOOKUPSWITCH instruction.
 501      *
 502      * @param dflt beginning of the default handler block.
 503      * @param keys the values of the keys.
 504      * @param labels beginnings of the handler blocks. <tt>labels[i]</tt> is
 505      *        the beginning of the handler block for the <tt>keys[i]</tt> key.
 506      */
 507     public void visitLookupSwitchInsn(Label dflt, int[] keys, Label[] labels) {
 508         if (mv != null) {
 509             mv.visitLookupSwitchInsn(dflt, keys, labels);
 510         }
 511     }
 512 
 513     /**
 514      * Visits a MULTIANEWARRAY instruction.
 515      *
 516      * @param desc an array type descriptor (see {@link Type Type}).
 517      * @param dims number of dimensions of the array to allocate.
 518      */
 519     public void visitMultiANewArrayInsn(String desc, int dims) {
 520         if (mv != null) {
 521             mv.visitMultiANewArrayInsn(desc, dims);
 522         }
 523     }
 524 
 525     // -------------------------------------------------------------------------
 526     // Exceptions table entries, debug information, max stack and max locals
 527     // -------------------------------------------------------------------------
 528 
 529     /**
 530      * Visits a try catch block.
 531      *
 532      * @param start beginning of the exception handler's scope (inclusive).
 533      * @param end end of the exception handler's scope (exclusive).
 534      * @param handler beginning of the exception handler's code.
 535      * @param type internal name of the type of exceptions handled by the
 536      *        handler, or <tt>null</tt> to catch any exceptions (for "finally"
 537      *        blocks).
 538      * @throws IllegalArgumentException if one of the labels has already been
 539      *         visited by this visitor (by the {@link #visitLabel visitLabel}
 540      *         method).
 541      */
 542     public void visitTryCatchBlock(Label start, Label end, Label handler, String type) {
 543         if (mv != null) {
 544             mv.visitTryCatchBlock(start, end, handler, type);
 545         }
 546     }
 547 
 548     /**
 549      * Visits a local variable declaration.
 550      *
 551      * @param name the name of a local variable.
 552      * @param desc the type descriptor of this local variable.
 553      * @param signature the type signature of this local variable. May be
 554      *        <tt>null</tt> if the local variable type does not use generic
 555      *        types.
 556      * @param start the first instruction corresponding to the scope of this
 557      *        local variable (inclusive).
 558      * @param end the last instruction corresponding to the scope of this local
 559      *        variable (exclusive).
 560      * @param index the local variable's index.
 561      * @throws IllegalArgumentException if one of the labels has not already
 562      *         been visited by this visitor (by the
 563      *         {@link #visitLabel visitLabel} method).
 564      */
 565     public void visitLocalVariable(
 566         String name,
 567         String desc,
 568         String signature,
 569         Label start,
 570         Label end,
 571         int index)
 572     {
 573         if (mv != null) {
 574             mv.visitLocalVariable(name, desc, signature, start, end, index);
 575         }
 576     }
 577 
 578     /**
 579      * Visits a line number declaration.
 580      *
 581      * @param line a line number. This number refers to the source file from
 582      *        which the class was compiled.
 583      * @param start the first instruction corresponding to this line number.
 584      * @throws IllegalArgumentException if <tt>start</tt> has not already been
 585      *         visited by this visitor (by the {@link #visitLabel visitLabel}
 586      *         method).
 587      */
 588     public void visitLineNumber(int line, Label start) {
 589         if (mv != null) {
 590             mv.visitLineNumber(line, start);
 591         }
 592     }
 593 
 594     /**
 595      * Visits the maximum stack size and the maximum number of local variables
 596      * of the method.
 597      *
 598      * @param maxStack maximum stack size of the method.
 599      * @param maxLocals maximum number of local variables for the method.
 600      */
 601     public void visitMaxs(int maxStack, int maxLocals) {
 602         if (mv != null) {
 603             mv.visitMaxs(maxStack, maxLocals);
 604         }
 605     }
 606 
 607     /**
 608      * Visits the end of the method. This method, which is the last one to be
 609      * called, is used to inform the visitor that all the annotations and
 610      * attributes of the method have been visited.
 611      */
 612     public void visitEnd() {
 613         if (mv != null) {
 614             mv.visitEnd();
 615         }
 616     }
 617 }