Package org.apache.bcel.generic

# Class InstructionConst

java.lang.Object
org.apache.bcel.generic.InstructionConst

public final class InstructionConst extends Object
Contains shareable instruction objects.

In order to save memory you can use some instructions multiply, since they have an immutable state and are directly derived from Instruction. I.e. they have no instance fields that could be changed. Since some of these instructions like ICONST_0 occur very frequently this can save a lot of time and space. This feature is an adaptation of the FlyWeight design pattern, we just use an array instead of a factory.

The Instructions can also accessed directly under their names, so it's possible to write il.append(Instruction.ICONST_0);

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final ArrayInstruction`
  `AALOAD`
  `static final ArrayInstruction`
  `AASTORE`
  `static final Instruction`
  `ACONST_NULL`
  `static final LocalVariableInstruction`
  `ALOAD_0`
  `static final LocalVariableInstruction`
  `ALOAD_1`
  `static final LocalVariableInstruction`
  `ALOAD_2`
  `static final ReturnInstruction`
  `ARETURN`
  `static final Instruction`
  `ARRAYLENGTH`
  `static final LocalVariableInstruction`
  `ASTORE_0`
  `static final LocalVariableInstruction`
  `ASTORE_1`
  `static final LocalVariableInstruction`
  `ASTORE_2`
  `static final Instruction`
  `ATHROW`
  `static final ArrayInstruction`
  `BALOAD`
  `static final ArrayInstruction`
  `BASTORE`
  `static final ArrayInstruction`
  `CALOAD`
  `static final ArrayInstruction`
  `CASTORE`
  `static final ConversionInstruction`
  `D2F`
  `static final ConversionInstruction`
  `D2I`
  `static final ConversionInstruction`
  `D2L`
  `static final ArithmeticInstruction`
  `DADD`
  `static final ArrayInstruction`
  `DALOAD`
  `static final ArrayInstruction`
  `DASTORE`
  `static final Instruction`
  `DCMPG`
  `static final Instruction`
  `DCMPL`
  `static final Instruction`
  `DCONST_0`
  `static final Instruction`
  `DCONST_1`
  `static final ArithmeticInstruction`
  `DDIV`
  `static final ArithmeticInstruction`
  `DMUL`
  `static final ArithmeticInstruction`
  `DNEG`
  `static final ArithmeticInstruction`
  `DREM`
  `static final ReturnInstruction`
  `DRETURN`
  `static final ArithmeticInstruction`
  `DSUB`
  `static final StackInstruction`
  `DUP`
  `static final StackInstruction`
  `DUP_X1`
  `static final StackInstruction`
  `DUP_X2`
  `static final StackInstruction`
  `DUP2`
  `static final StackInstruction`
  `DUP2_X1`
  `static final StackInstruction`
  `DUP2_X2`
  `static final ConversionInstruction`
  `F2D`
  `static final ConversionInstruction`
  `F2I`
  `static final ConversionInstruction`
  `F2L`
  `static final ArithmeticInstruction`
  `FADD`
  `static final ArrayInstruction`
  `FALOAD`
  `static final ArrayInstruction`
  `FASTORE`
  `static final Instruction`
  `FCMPG`
  `static final Instruction`
  `FCMPL`
  `static final Instruction`
  `FCONST_0`
  `static final Instruction`
  `FCONST_1`
  `static final Instruction`
  `FCONST_2`
  `static final ArithmeticInstruction`
  `FDIV`
  `static final ArithmeticInstruction`
  `FMUL`
  `static final ArithmeticInstruction`
  `FNEG`
  `static final ArithmeticInstruction`
  `FREM`
  `static final ReturnInstruction`
  `FRETURN`
  `static final ArithmeticInstruction`
  `FSUB`
  `static final ConversionInstruction`
  `I2B`
  `static final ConversionInstruction`
  `I2C`
  `static final ConversionInstruction`
  `I2D`
  `static final ConversionInstruction`
  `I2F`
  `static final ConversionInstruction`
  `I2L`
  `static final ConversionInstruction`
  `I2S`
  `static final ArithmeticInstruction`
  `IADD`
  `static final ArrayInstruction`
  `IALOAD`
  `static final ArithmeticInstruction`
  `IAND`
  `static final ArrayInstruction`
  `IASTORE`
  `static final Instruction`
  `ICONST_0`
  `static final Instruction`
  `ICONST_1`
  `static final Instruction`
  `ICONST_2`
  `static final Instruction`
  `ICONST_3`
  `static final Instruction`
  `ICONST_4`
  `static final Instruction`
  `ICONST_5`
  `static final Instruction`
  `ICONST_M1`
  `static final ArithmeticInstruction`
  `IDIV`
  `static final LocalVariableInstruction`
  `ILOAD_0`
  `static final LocalVariableInstruction`
  `ILOAD_1`
  `static final LocalVariableInstruction`
  `ILOAD_2`
  `static final ArithmeticInstruction`
  `IMUL`
  `static final ArithmeticInstruction`
  `INEG`
  `static final ArithmeticInstruction`
  `IOR`
  `static final ArithmeticInstruction`
  `IREM`
  `static final ReturnInstruction`
  `IRETURN`
  `static final ArithmeticInstruction`
  `ISHL`
  `static final ArithmeticInstruction`
  `ISHR`
  `static final LocalVariableInstruction`
  `ISTORE_0`
  `static final LocalVariableInstruction`
  `ISTORE_1`
  `static final LocalVariableInstruction`
  `ISTORE_2`
  `static final ArithmeticInstruction`
  `ISUB`
  `static final ArithmeticInstruction`
  `IUSHR`
  `static final ArithmeticInstruction`
  `IXOR`
  `static final ConversionInstruction`
  `L2D`
  `static final ConversionInstruction`
  `L2F`
  `static final ConversionInstruction`
  `L2I`
  `static final ArithmeticInstruction`
  `LADD`
  `static final ArrayInstruction`
  `LALOAD`
  `static final ArithmeticInstruction`
  `LAND`
  `static final ArrayInstruction`
  `LASTORE`
  `static final Instruction`
  `LCMP`
  `static final Instruction`
  `LCONST_0`
  `static final Instruction`
  `LCONST_1`
  `static final ArithmeticInstruction`
  `LDIV`
  `static final ArithmeticInstruction`
  `LMUL`
  `static final ArithmeticInstruction`
  `LNEG`
  `static final ArithmeticInstruction`
  `LOR`
  `static final ArithmeticInstruction`
  `LREM`
  `static final ReturnInstruction`
  `LRETURN`
  `static final ArithmeticInstruction`
  `LSHL`
  `static final ArithmeticInstruction`
  `LSHR`
  `static final ArithmeticInstruction`
  `LSUB`
  `static final ArithmeticInstruction`
  `LUSHR`
  `static final ArithmeticInstruction`
  `LXOR`
  `static final Instruction`
  `MONITORENTER`
  `static final Instruction`
  `MONITOREXIT`
  `static final Instruction`
  `NOP`
  Predefined instruction objects.
  `static final StackInstruction`
  `POP`
  `static final StackInstruction`
  `POP2`
  `static final ReturnInstruction`
  `RETURN`
  `static final ArrayInstruction`
  `SALOAD`
  `static final ArrayInstruction`
  `SASTORE`
  `static final StackInstruction`
  `SWAP`
  `static final LocalVariableInstruction`
  `THIS`
  You can use these constants in multiple places safely, if you can guarantee that you will never alter their internal values, e.g.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static Instruction`
  `getInstruction(int index)`
  Gets the Instruction.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### NOP

    public static final Instruction NOP
    Predefined instruction objects. NOTE these are not currently immutable, because Instruction has mutable protected fields opcode and length.

  - ### ACONST_NULL

    public static final Instruction ACONST_NULL

  - ### ICONST_M1

    public static final Instruction ICONST_M1

  - ### ICONST_0

    public static final Instruction ICONST_0

  - ### ICONST_1

    public static final Instruction ICONST_1

  - ### ICONST_2

    public static final Instruction ICONST_2

  - ### ICONST_3

    public static final Instruction ICONST_3

  - ### ICONST_4

    public static final Instruction ICONST_4

  - ### ICONST_5

    public static final Instruction ICONST_5

  - ### LCONST_0

    public static final Instruction LCONST_0

  - ### LCONST_1

    public static final Instruction LCONST_1

  - ### FCONST_0

    public static final Instruction FCONST_0

  - ### FCONST_1

    public static final Instruction FCONST_1

  - ### FCONST_2

    public static final Instruction FCONST_2

  - ### DCONST_0

    public static final Instruction DCONST_0

  - ### DCONST_1

    public static final Instruction DCONST_1

  - ### IALOAD

    public static final ArrayInstruction IALOAD

  - ### LALOAD

    public static final ArrayInstruction LALOAD

  - ### FALOAD

    public static final ArrayInstruction FALOAD

  - ### DALOAD

    public static final ArrayInstruction DALOAD

  - ### AALOAD

    public static final ArrayInstruction AALOAD

  - ### BALOAD

    public static final ArrayInstruction BALOAD

  - ### CALOAD

    public static final ArrayInstruction CALOAD

  - ### SALOAD

    public static final ArrayInstruction SALOAD

  - ### IASTORE

    public static final ArrayInstruction IASTORE

  - ### LASTORE

    public static final ArrayInstruction LASTORE

  - ### FASTORE

    public static final ArrayInstruction FASTORE

  - ### DASTORE

    public static final ArrayInstruction DASTORE

  - ### AASTORE

    public static final ArrayInstruction AASTORE

  - ### BASTORE

    public static final ArrayInstruction BASTORE

  - ### CASTORE

    public static final ArrayInstruction CASTORE

  - ### SASTORE

    public static final ArrayInstruction SASTORE

  - ### POP

    public static final StackInstruction POP

  - ### POP2

    public static final StackInstruction POP2

  - ### DUP

    public static final StackInstruction DUP

  - ### DUP_X1

    public static final StackInstruction DUP_X1

  - ### DUP_X2

    public static final StackInstruction DUP_X2

  - ### DUP2

    public static final StackInstruction DUP2

  - ### DUP2_X1

    public static final StackInstruction DUP2_X1

  - ### DUP2_X2

    public static final StackInstruction DUP2_X2

  - ### SWAP

    public static final StackInstruction SWAP

  - ### IADD

    public static final ArithmeticInstruction IADD

  - ### LADD

    public static final ArithmeticInstruction LADD

  - ### FADD

    public static final ArithmeticInstruction FADD

  - ### DADD

    public static final ArithmeticInstruction DADD

  - ### ISUB

    public static final ArithmeticInstruction ISUB

  - ### LSUB

    public static final ArithmeticInstruction LSUB

  - ### FSUB

    public static final ArithmeticInstruction FSUB

  - ### DSUB

    public static final ArithmeticInstruction DSUB

  - ### IMUL

    public static final ArithmeticInstruction IMUL

  - ### LMUL

    public static final ArithmeticInstruction LMUL

  - ### FMUL

    public static final ArithmeticInstruction FMUL

  - ### DMUL

    public static final ArithmeticInstruction DMUL

  - ### IDIV

    public static final ArithmeticInstruction IDIV

  - ### LDIV

    public static final ArithmeticInstruction LDIV

  - ### FDIV

    public static final ArithmeticInstruction FDIV

  - ### DDIV

    public static final ArithmeticInstruction DDIV

  - ### IREM

    public static final ArithmeticInstruction IREM

  - ### LREM

    public static final ArithmeticInstruction LREM

  - ### FREM

    public static final ArithmeticInstruction FREM

  - ### DREM

    public static final ArithmeticInstruction DREM

  - ### INEG

    public static final ArithmeticInstruction INEG

  - ### LNEG

    public static final ArithmeticInstruction LNEG

  - ### FNEG

    public static final ArithmeticInstruction FNEG

  - ### DNEG

    public static final ArithmeticInstruction DNEG

  - ### ISHL

    public static final ArithmeticInstruction ISHL

  - ### LSHL

    public static final ArithmeticInstruction LSHL

  - ### ISHR

    public static final ArithmeticInstruction ISHR

  - ### LSHR

    public static final ArithmeticInstruction LSHR

  - ### IUSHR

    public static final ArithmeticInstruction IUSHR

  - ### LUSHR

    public static final ArithmeticInstruction LUSHR

  - ### IAND

    public static final ArithmeticInstruction IAND

  - ### LAND

    public static final ArithmeticInstruction LAND

  - ### IOR

    public static final ArithmeticInstruction IOR

  - ### LOR

    public static final ArithmeticInstruction LOR

  - ### IXOR

    public static final ArithmeticInstruction IXOR

  - ### LXOR

    public static final ArithmeticInstruction LXOR

  - ### I2L

    public static final ConversionInstruction I2L

  - ### I2F

    public static final ConversionInstruction I2F

  - ### I2D

    public static final ConversionInstruction I2D

  - ### L2I

    public static final ConversionInstruction L2I

  - ### L2F

    public static final ConversionInstruction L2F

  - ### L2D

    public static final ConversionInstruction L2D

  - ### F2I

    public static final ConversionInstruction F2I

  - ### F2L

    public static final ConversionInstruction F2L

  - ### F2D

    public static final ConversionInstruction F2D

  - ### D2I

    public static final ConversionInstruction D2I

  - ### D2L

    public static final ConversionInstruction D2L

  - ### D2F

    public static final ConversionInstruction D2F

  - ### I2B

    public static final ConversionInstruction I2B

  - ### I2C

    public static final ConversionInstruction I2C

  - ### I2S

    public static final ConversionInstruction I2S

  - ### LCMP

    public static final Instruction LCMP

  - ### FCMPL

    public static final Instruction FCMPL

  - ### FCMPG

    public static final Instruction FCMPG

  - ### DCMPL

    public static final Instruction DCMPL

  - ### DCMPG

    public static final Instruction DCMPG

  - ### IRETURN

    public static final ReturnInstruction IRETURN

  - ### LRETURN

    public static final ReturnInstruction LRETURN

  - ### FRETURN

    public static final ReturnInstruction FRETURN

  - ### DRETURN

    public static final ReturnInstruction DRETURN

  - ### ARETURN

    public static final ReturnInstruction ARETURN

  - ### RETURN

    public static final ReturnInstruction RETURN

  - ### ARRAYLENGTH

    public static final Instruction ARRAYLENGTH

  - ### ATHROW

    public static final Instruction ATHROW

  - ### MONITORENTER

    public static final Instruction MONITORENTER

  - ### MONITOREXIT

    public static final Instruction MONITOREXIT

  - ### THIS

    public static final LocalVariableInstruction THIS
    You can use these constants in multiple places safely, if you can guarantee that you will never alter their internal values, e.g. call setIndex().

  - ### ALOAD_0

    public static final LocalVariableInstruction ALOAD_0

  - ### ALOAD_1

    public static final LocalVariableInstruction ALOAD_1

  - ### ALOAD_2

    public static final LocalVariableInstruction ALOAD_2

  - ### ILOAD_0

    public static final LocalVariableInstruction ILOAD_0

  - ### ILOAD_1

    public static final LocalVariableInstruction ILOAD_1

  - ### ILOAD_2

    public static final LocalVariableInstruction ILOAD_2

  - ### ASTORE_0

    public static final LocalVariableInstruction ASTORE_0

  - ### ASTORE_1

    public static final LocalVariableInstruction ASTORE_1

  - ### ASTORE_2

    public static final LocalVariableInstruction ASTORE_2

  - ### ISTORE_0

    public static final LocalVariableInstruction ISTORE_0

  - ### ISTORE_1

    public static final LocalVariableInstruction ISTORE_1

  - ### ISTORE_2

    public static final LocalVariableInstruction ISTORE_2

- ## Method Details

  - ### getInstruction

    public static Instruction getInstruction(int index)
    Gets the Instruction.
    Parameters:
      `index` - the index, e.g. `Const.RETURN`
    Returns:
      the entry from the private INSTRUCTIONS table