1 17 package org.apache.bcel.generic; 18 19 25 public abstract class ArrayInstruction extends Instruction implements ExceptionThrower, 26 TypedInstruction { 27 28 32 ArrayInstruction() { 33 } 34 35 36 39 protected ArrayInstruction(short opcode) { 40 super(opcode, (short) 1); 41 } 42 43 44 public Class [] getExceptions() { 45 return org.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION; 46 } 47 48 49 51 public Type getType( ConstantPoolGen cp ) { 52 switch (opcode) { 53 case org.apache.bcel.Constants.IALOAD: 54 case org.apache.bcel.Constants.IASTORE: 55 return Type.INT; 56 case org.apache.bcel.Constants.CALOAD: 57 case org.apache.bcel.Constants.CASTORE: 58 return Type.CHAR; 59 case org.apache.bcel.Constants.BALOAD: 60 case org.apache.bcel.Constants.BASTORE: 61 return Type.BYTE; 62 case org.apache.bcel.Constants.SALOAD: 63 case org.apache.bcel.Constants.SASTORE: 64 return Type.SHORT; 65 case org.apache.bcel.Constants.LALOAD: 66 case org.apache.bcel.Constants.LASTORE: 67 return Type.LONG; 68 case org.apache.bcel.Constants.DALOAD: 69 case org.apache.bcel.Constants.DASTORE: 70 return Type.DOUBLE; 71 case org.apache.bcel.Constants.FALOAD: 72 case org.apache.bcel.Constants.FASTORE: 73 return Type.FLOAT; 74 case org.apache.bcel.Constants.AALOAD: 75 case org.apache.bcel.Constants.AASTORE: 76 return Type.OBJECT; 77 default: 78 throw new ClassGenException("Oops: unknown case in switch" + opcode); 79 } 80 } 81 } 82 | Popular Tags |