1 package com.sun.org.apache.bcel.internal.generic; 2 3 56 import java.io.*; 57 import com.sun.org.apache.bcel.internal.ExceptionConstants; 58 59 66 public class NEW extends CPInstruction 67 implements LoadClass, AllocationInstruction, ExceptionThrower, StackProducer { 68 72 NEW() {} 73 74 public NEW(int index) { 75 super(com.sun.org.apache.bcel.internal.Constants.NEW, index); 76 } 77 78 public Class [] getExceptions(){ 79 Class [] cs = new Class [2 + ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length]; 80 81 System.arraycopy(ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION, 0, 82 cs, 0, ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length); 83 84 cs[ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length+1] = ExceptionConstants.INSTANTIATION_ERROR; 85 cs[ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length] = ExceptionConstants.ILLEGAL_ACCESS_ERROR; 86 87 return cs; 88 } 89 90 public ObjectType getLoadClassType(ConstantPoolGen cpg) { 91 return (ObjectType)getType(cpg); 92 } 93 94 102 public void accept(Visitor v) { 103 v.visitLoadClass(this); 104 v.visitAllocationInstruction(this); 105 v.visitExceptionThrower(this); 106 v.visitStackProducer(this); 107 v.visitTypedInstruction(this); 108 v.visitCPInstruction(this); 109 v.visitNEW(this); 110 } 111 } 112 | Popular Tags |