Class FieldInstruction

All Implemented Interfaces:
Cloneable, IndexedInstruction, LoadClass, TypedInstruction
Direct Known Subclasses:
GETFIELD, GETSTATIC, PUTFIELD, PUTSTATIC

public abstract class FieldInstruction extends FieldOrMethod
Super class for the GET/PUTxxx family of instructions.
  • Constructor Details

    • FieldInstruction

      FieldInstruction()
      Empty constructor needed for Instruction.readInstruction. Not to be used otherwise.
    • FieldInstruction

      protected FieldInstruction(short opcode, int index)
      Constructs a FieldInstruction.
      Parameters:
      opcode - The opcode.
      index - to constant pool.
  • Method Details

    • getFieldName

      public String getFieldName(ConstantPoolGen cpg)
      Gets the name of referenced field.
      Parameters:
      cpg - The constant pool generator.
      Returns:
      name of referenced field.
    • getFieldSize

      protected int getFieldSize(ConstantPoolGen cpg)
      Gets the size of field.
      Parameters:
      cpg - The constant pool generator.
      Returns:
      size of field (1 or 2).
    • getFieldType

      public Type getFieldType(ConstantPoolGen cpg)
      Gets the type of field.
      Parameters:
      cpg - The constant pool generator.
      Returns:
      type of field.
    • getType

      public Type getType(ConstantPoolGen cpg)
      Description copied from interface: TypedInstruction
      Gets the type associated with this instruction.
      Specified by:
      getType in interface LoadClass
      Specified by:
      getType in interface TypedInstruction
      Overrides:
      getType in class CPInstruction
      Parameters:
      cpg - The constant pool generator.
      Returns:
      return type of referenced field.
      See Also:
    • toString

      public String toString(ConstantPool cp)
      Description copied from class: Instruction
      Gets the mnemonic for instruction with symbolic references resolved.
      Overrides:
      toString in class CPInstruction
      Parameters:
      cp - The constant pool.
      Returns:
      mnemonic for instruction with symbolic references resolved.