1 package com.sun.org.apache.bcel.internal.generic; 2 3 56 import com.sun.org.apache.bcel.internal.Constants; 57 import com.sun.org.apache.bcel.internal.ExceptionConstants; 58 59 65 public abstract class ReturnInstruction extends Instruction 66 implements ExceptionThrower, TypedInstruction, StackConsumer { 67 71 ReturnInstruction() {} 72 73 76 protected ReturnInstruction(short opcode) { 77 super(opcode, (short)1); 78 } 79 80 public Type getType() { 81 switch(opcode) { 82 case Constants.IRETURN: return Type.INT; 83 case Constants.LRETURN: return Type.LONG; 84 case Constants.FRETURN: return Type.FLOAT; 85 case Constants.DRETURN: return Type.DOUBLE; 86 case Constants.ARETURN: return Type.OBJECT; 87 case Constants.RETURN: return Type.VOID; 88 89 default: throw new ClassGenException("Unknown type " + opcode); 91 } 92 } 93 94 public Class [] getExceptions() { 95 return new Class [] { ExceptionConstants.ILLEGAL_MONITOR_STATE }; 96 } 97 98 100 public Type getType(ConstantPoolGen cp) { 101 return getType(); 102 } 103 } 104 105 | Popular Tags |