Main Page   Packages   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

ReturnInstruction.java

00001 package de.fub.bytecode.generic;
00002 
00003 import de.fub.bytecode.Constants;
00004 import de.fub.bytecode.ExceptionConstants;
00005 
00006 /**
00007  * Super class for the xRETURN family of instructions.
00008  *
00009  * @version $Id: ReturnInstruction.java,v 1.1.1.1 2002/01/24 03:41:41 pserver Exp $
00010  * @author  <A HREF="http://www.inf.fu-berlin.de/~dahm">M. Dahm</A>
00011  */
00012 public abstract class ReturnInstruction extends Instruction
00013   implements ExceptionThrower, TypedInstruction, StackConsumer {
00014   /**
00015    * Empty constructor needed for the Class.newInstance() statement in
00016    * Instruction.readInstruction(). Not to be used otherwise.
00017    */
00018   ReturnInstruction() {}  
00019   /**
00020    * @param tag opcode of instruction
00021    */
00022   protected ReturnInstruction(short tag) {
00023     super(tag, (short)1);
00024   }  
00025   public Class[] getExceptions() {
00026     return new Class[] { ExceptionConstants.ILLEGAL_MONITOR_STATE };
00027   }  
00028   public Type getType() {
00029     switch(tag) {
00030       case Constants.IRETURN: return Type.INT;
00031       case Constants.LRETURN: return Type.LONG;
00032       case Constants.FRETURN: return Type.FLOAT;
00033       case Constants.DRETURN: return Type.DOUBLE;
00034       case Constants.ARETURN: return Type.OBJECT;
00035       case Constants.RETURN:  return Type.VOID;
00036  
00037     default: // Never reached
00038       throw new ClassGenException("Unknown type " + tag);
00039     }
00040   }  
00041   /** @return type associated with the instruction
00042    */
00043   public Type getType(ConstantPoolGen cp) {
00044     return getType();
00045   }  
00046 }

Generated at Thu Feb 7 06:53:58 2002 for Bandera by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001