FileDocCategorySizeDatePackage
ArrayInstruction.javaAPI DocJava SE 5 API4834Fri Aug 26 14:55:18 BST 2005com.sun.org.apache.bcel.internal.generic

ArrayInstruction

public abstract class ArrayInstruction extends Instruction implements ExceptionThrower, TypedInstruction
Super class for instructions dealing with array access such as IALOAD.
version
$Id: ArrayInstruction.java,v 1.1.1.1 2001/10/29 20:00:06 jvanzyl Exp $
author
M. Dahm

Fields Summary
Constructors Summary
ArrayInstruction()
Empty constructor needed for the Class.newInstance() statement in Instruction.readInstruction(). Not to be used otherwise.

protected ArrayInstruction(short opcode)

param
opcode of instruction

    super(opcode, (short)1);
  
Methods Summary
public java.lang.Class[]getExceptions()

    return com.sun.org.apache.bcel.internal.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
  
public com.sun.org.apache.bcel.internal.generic.TypegetType(com.sun.org.apache.bcel.internal.generic.ConstantPoolGen cp)

return
type associated with the instruction

    switch(opcode) {
    case com.sun.org.apache.bcel.internal.Constants.IALOAD: case com.sun.org.apache.bcel.internal.Constants.IASTORE: 
      return Type.INT;
    case com.sun.org.apache.bcel.internal.Constants.CALOAD: case com.sun.org.apache.bcel.internal.Constants.CASTORE: 
      return Type.CHAR;
    case com.sun.org.apache.bcel.internal.Constants.BALOAD: case com.sun.org.apache.bcel.internal.Constants.BASTORE:
      return Type.BYTE;
    case com.sun.org.apache.bcel.internal.Constants.SALOAD: case com.sun.org.apache.bcel.internal.Constants.SASTORE:
      return Type.SHORT;
    case com.sun.org.apache.bcel.internal.Constants.LALOAD: case com.sun.org.apache.bcel.internal.Constants.LASTORE: 
      return Type.LONG;
    case com.sun.org.apache.bcel.internal.Constants.DALOAD: case com.sun.org.apache.bcel.internal.Constants.DASTORE: 
      return Type.DOUBLE;
    case com.sun.org.apache.bcel.internal.Constants.FALOAD: case com.sun.org.apache.bcel.internal.Constants.FASTORE: 
      return Type.FLOAT;
    case com.sun.org.apache.bcel.internal.Constants.AALOAD: case com.sun.org.apache.bcel.internal.Constants.AASTORE:
      return Type.OBJECT;

    default: throw new ClassGenException("Oops: unknown case in switch" + opcode);
    }