< prev index next >

src/java.base/share/classes/jdk/internal/org/objectweb/asm/commons/InstructionAdapter.java

Print this page
rev 47452 : imported patch jdk-new-asmv6.patch


  69  * A {@link MethodVisitor} providing a more detailed API to generate and
  70  * transform instructions.
  71  *
  72  * @author Eric Bruneton
  73  */
  74 public class InstructionAdapter extends MethodVisitor {
  75 
  76     public final static Type OBJECT_TYPE = Type.getType("Ljava/lang/Object;");
  77 
  78     /**
  79      * Creates a new {@link InstructionAdapter}. <i>Subclasses must not use this
  80      * constructor</i>. Instead, they must use the
  81      * {@link #InstructionAdapter(int, MethodVisitor)} version.
  82      *
  83      * @param mv
  84      *            the method visitor to which this adapter delegates calls.
  85      * @throws IllegalStateException
  86      *             If a subclass calls this constructor.
  87      */
  88     public InstructionAdapter(final MethodVisitor mv) {
  89         this(Opcodes.ASM5, mv);
  90         if (getClass() != InstructionAdapter.class) {
  91             throw new IllegalStateException();
  92         }
  93     }
  94 
  95     /**
  96      * Creates a new {@link InstructionAdapter}.
  97      *
  98      * @param api
  99      *            the ASM API version implemented by this visitor. Must be one
 100      *            of {@link Opcodes#ASM4} or {@link Opcodes#ASM5}.
 101      * @param mv
 102      *            the method visitor to which this adapter delegates calls.
 103      */
 104     protected InstructionAdapter(final int api, final MethodVisitor mv) {
 105         super(api, mv);
 106     }
 107 
 108     @Override
 109     public void visitInsn(final int opcode) {
 110         switch (opcode) {
 111         case Opcodes.NOP:
 112             nop();
 113             break;
 114         case Opcodes.ACONST_NULL:
 115             aconst(null);
 116             break;
 117         case Opcodes.ICONST_M1:
 118         case Opcodes.ICONST_0:
 119         case Opcodes.ICONST_1:
 120         case Opcodes.ICONST_2:




  69  * A {@link MethodVisitor} providing a more detailed API to generate and
  70  * transform instructions.
  71  *
  72  * @author Eric Bruneton
  73  */
  74 public class InstructionAdapter extends MethodVisitor {
  75 
  76     public final static Type OBJECT_TYPE = Type.getType("Ljava/lang/Object;");
  77 
  78     /**
  79      * Creates a new {@link InstructionAdapter}. <i>Subclasses must not use this
  80      * constructor</i>. Instead, they must use the
  81      * {@link #InstructionAdapter(int, MethodVisitor)} version.
  82      *
  83      * @param mv
  84      *            the method visitor to which this adapter delegates calls.
  85      * @throws IllegalStateException
  86      *             If a subclass calls this constructor.
  87      */
  88     public InstructionAdapter(final MethodVisitor mv) {
  89         this(Opcodes.ASM6, mv);
  90         if (getClass() != InstructionAdapter.class) {
  91             throw new IllegalStateException();
  92         }
  93     }
  94 
  95     /**
  96      * Creates a new {@link InstructionAdapter}.
  97      *
  98      * @param api
  99      *            the ASM API version implemented by this visitor. Must be one
 100      *            of {@link Opcodes#ASM4}, {@link Opcodes#ASM5} or {@link Opcodes#ASM6}.
 101      * @param mv
 102      *            the method visitor to which this adapter delegates calls.
 103      */
 104     protected InstructionAdapter(final int api, final MethodVisitor mv) {
 105         super(api, mv);
 106     }
 107 
 108     @Override
 109     public void visitInsn(final int opcode) {
 110         switch (opcode) {
 111         case Opcodes.NOP:
 112             nop();
 113             break;
 114         case Opcodes.ACONST_NULL:
 115             aconst(null);
 116             break;
 117         case Opcodes.ICONST_M1:
 118         case Opcodes.ICONST_0:
 119         case Opcodes.ICONST_1:
 120         case Opcodes.ICONST_2:


< prev index next >