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

NEW.java

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

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