src/share/classes/jdk/internal/org/objectweb/asm/tree/LdcInsnNode.java

Print this page




  63 import jdk.internal.org.objectweb.asm.MethodVisitor;
  64 import jdk.internal.org.objectweb.asm.Opcodes;
  65 
  66 /**
  67  * A node that represents an LDC instruction.
  68  *
  69  * @author Eric Bruneton
  70  */
  71 public class LdcInsnNode extends AbstractInsnNode {
  72 
  73     /**
  74      * The constant to be loaded on the stack. This parameter must be a non null
  75      * {@link Integer}, a {@link Float}, a {@link Long}, a {@link Double}, a
  76      * {@link String} or a {@link jdk.internal.org.objectweb.asm.Type}.
  77      */
  78     public Object cst;
  79 
  80     /**
  81      * Constructs a new {@link LdcInsnNode}.
  82      *
  83      * @param cst the constant to be loaded on the stack. This parameter must be

  84      *        a non null {@link Integer}, a {@link Float}, a {@link Long}, a
  85      *        {@link Double} or a {@link String}.
  86      */
  87     public LdcInsnNode(final Object cst) {
  88         super(Opcodes.LDC);
  89         this.cst = cst;
  90     }
  91 
  92     @Override
  93     public int getType() {
  94         return LDC_INSN;
  95     }
  96 
  97     @Override
  98     public void accept(final MethodVisitor mv) {
  99         mv.visitLdcInsn(cst);

 100     }
 101 
 102     @Override
 103     public AbstractInsnNode clone(final Map<LabelNode, LabelNode> labels) {
 104         return new LdcInsnNode(cst);
 105     }
 106 }


  63 import jdk.internal.org.objectweb.asm.MethodVisitor;
  64 import jdk.internal.org.objectweb.asm.Opcodes;
  65 
  66 /**
  67  * A node that represents an LDC instruction.
  68  *
  69  * @author Eric Bruneton
  70  */
  71 public class LdcInsnNode extends AbstractInsnNode {
  72 
  73     /**
  74      * The constant to be loaded on the stack. This parameter must be a non null
  75      * {@link Integer}, a {@link Float}, a {@link Long}, a {@link Double}, a
  76      * {@link String} or a {@link jdk.internal.org.objectweb.asm.Type}.
  77      */
  78     public Object cst;
  79 
  80     /**
  81      * Constructs a new {@link LdcInsnNode}.
  82      *
  83      * @param cst
  84      *            the constant to be loaded on the stack. This parameter must be
  85      *            a non null {@link Integer}, a {@link Float}, a {@link Long}, a
  86      *            {@link Double} or a {@link String}.
  87      */
  88     public LdcInsnNode(final Object cst) {
  89         super(Opcodes.LDC);
  90         this.cst = cst;
  91     }
  92 
  93     @Override
  94     public int getType() {
  95         return LDC_INSN;
  96     }
  97 
  98     @Override
  99     public void accept(final MethodVisitor mv) {
 100         mv.visitLdcInsn(cst);
 101         acceptAnnotations(mv);
 102     }
 103 
 104     @Override
 105     public AbstractInsnNode clone(final Map<LabelNode, LabelNode> labels) {
 106         return new LdcInsnNode(cst).cloneAnnotations(this);
 107     }
 108 }