1 17 package org.apache.bcel.generic; 18 19 import org.apache.bcel.Constants; 20 import org.apache.bcel.ExceptionConstants; 21 22 31 public class PUTFIELD extends FieldInstruction implements PopInstruction, ExceptionThrower { 32 33 37 PUTFIELD() { 38 } 39 40 41 public PUTFIELD(int index) { 42 super(Constants.PUTFIELD, index); 43 } 44 45 46 public int consumeStack( ConstantPoolGen cpg ) { 47 return getFieldSize(cpg) + 1; 48 } 49 50 51 public Class [] getExceptions() { 52 Class [] cs = new Class [2 + ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length]; 53 System.arraycopy(ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION, 0, cs, 0, 54 ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length); 55 cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length + 1] = ExceptionConstants.INCOMPATIBLE_CLASS_CHANGE_ERROR; 56 cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length] = ExceptionConstants.NULL_POINTER_EXCEPTION; 57 return cs; 58 } 59 60 61 69 public void accept( Visitor v ) { 70 v.visitExceptionThrower(this); 71 v.visitStackConsumer(this); 72 v.visitPopInstruction(this); 73 v.visitTypedInstruction(this); 74 v.visitLoadClass(this); 75 v.visitCPInstruction(this); 76 v.visitFieldOrMethod(this); 77 v.visitFieldInstruction(this); 78 v.visitPUTFIELD(this); 79 } 80 } 81 | Popular Tags |