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

CHECKCAST.java

00001 package de.fub.bytecode.generic;
00002 
00003 import de.fub.bytecode.ExceptionConstants;
00004 /** 
00005  * CHECKCAST - Check whether object is of given type
00006  * <PRE>Stack: ..., objectref -&gt; ..., objectref</PRE>
00007  *
00008  * @version $Id: CHECKCAST.java,v 1.1.1.1 2002/01/24 03:41:38 pserver Exp $
00009  * @author  <A HREF="http://www.inf.fu-berlin.de/~dahm">M. Dahm</A>
00010  */
00011 public class CHECKCAST extends CPInstruction
00012   implements LoadClass, ExceptionThrower, StackProducer, StackConsumer {
00013   /**
00014    * Empty constructor needed for the Class.newInstance() statement in
00015    * Instruction.readInstruction(). Not to be used otherwise.
00016    */
00017   CHECKCAST() {}  
00018   /** Check whether object is of given type
00019    * @param n index to class in constant pool
00020    */
00021   public CHECKCAST(int index) {
00022     super(de.fub.bytecode.Constants.CHECKCAST, index);
00023   }  
00024   /**
00025    * Call corresponding visitor method(s). The order is:
00026    * Call visitor methods of implemented interfaces first, then
00027    * call methods according to the class hierarchy in descending order,
00028    * i.e., the most specific visitXXX() call comes last.
00029    *
00030    * @param v Visitor object
00031    */
00032   public void accept(Visitor v) {
00033     v.visitLoadClass(this);
00034     v.visitExceptionThrower(this);
00035     v.visitStackProducer(this);
00036     v.visitStackConsumer(this);
00037     v.visitTypedInstruction(this);
00038     v.visitCPInstruction(this);
00039     v.visitCHECKCAST(this);
00040   }  
00041   /** @return exceptions this instruction may cause
00042    */
00043   public Class[] getExceptions() {
00044     Class[] cs = new Class[1 + ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length];
00045 
00046     System.arraycopy(ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION, 0,
00047              cs, 0, ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length);
00048     cs[ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length] =
00049       ExceptionConstants.CLASS_CAST_EXCEPTION;
00050     return cs;
00051   }  
00052 }

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