1 17 package org.apache.bcel.generic; 18 19 import org.apache.bcel.Constants; 20 import org.apache.bcel.ExceptionConstants; 21 22 28 public abstract class ReturnInstruction extends Instruction implements ExceptionThrower, 29 TypedInstruction, StackConsumer { 30 31 35 ReturnInstruction() { 36 } 37 38 39 42 protected ReturnInstruction(short opcode) { 43 super(opcode, (short) 1); 44 } 45 46 47 public Type getType() { 48 switch (opcode) { 49 case Constants.IRETURN: 50 return Type.INT; 51 case Constants.LRETURN: 52 return Type.LONG; 53 case Constants.FRETURN: 54 return Type.FLOAT; 55 case Constants.DRETURN: 56 return Type.DOUBLE; 57 case Constants.ARETURN: 58 return Type.OBJECT; 59 case Constants.RETURN: 60 return Type.VOID; 61 default: throw new ClassGenException("Unknown type " + opcode); 63 } 64 } 65 66 67 public Class [] getExceptions() { 68 return new Class [] { 69 ExceptionConstants.ILLEGAL_MONITOR_STATE 70 }; 71 } 72 73 74 76 public Type getType( ConstantPoolGen cp ) { 77 return getType(); 78 } 79 } 80 | Popular Tags |