1 package com.sun.org.apache.bcel.internal.generic; 2 3 56 57 63 public abstract class ArrayInstruction extends Instruction 64 implements ExceptionThrower, TypedInstruction { 65 69 ArrayInstruction() {} 70 71 74 protected ArrayInstruction(short opcode) { 75 super(opcode, (short)1); 76 } 77 78 public Class [] getExceptions() { 79 return com.sun.org.apache.bcel.internal.ExceptionConstants.EXCS_ARRAY_EXCEPTION; 80 } 81 82 84 public Type getType(ConstantPoolGen cp) { 85 switch(opcode) { 86 case com.sun.org.apache.bcel.internal.Constants.IALOAD: case com.sun.org.apache.bcel.internal.Constants.IASTORE: 87 return Type.INT; 88 case com.sun.org.apache.bcel.internal.Constants.CALOAD: case com.sun.org.apache.bcel.internal.Constants.CASTORE: 89 return Type.CHAR; 90 case com.sun.org.apache.bcel.internal.Constants.BALOAD: case com.sun.org.apache.bcel.internal.Constants.BASTORE: 91 return Type.BYTE; 92 case com.sun.org.apache.bcel.internal.Constants.SALOAD: case com.sun.org.apache.bcel.internal.Constants.SASTORE: 93 return Type.SHORT; 94 case com.sun.org.apache.bcel.internal.Constants.LALOAD: case com.sun.org.apache.bcel.internal.Constants.LASTORE: 95 return Type.LONG; 96 case com.sun.org.apache.bcel.internal.Constants.DALOAD: case com.sun.org.apache.bcel.internal.Constants.DASTORE: 97 return Type.DOUBLE; 98 case com.sun.org.apache.bcel.internal.Constants.FALOAD: case com.sun.org.apache.bcel.internal.Constants.FASTORE: 99 return Type.FLOAT; 100 case com.sun.org.apache.bcel.internal.Constants.AALOAD: case com.sun.org.apache.bcel.internal.Constants.AASTORE: 101 return Type.OBJECT; 102 103 default: throw new ClassGenException("Oops: unknown case in switch" + opcode); 104 } 105 } 106 } 107 | Popular Tags |