1 package com.sun.org.apache.bcel.internal.generic; 2 3 56 57 import com.sun.org.apache.bcel.internal.Constants; 58 import com.sun.org.apache.bcel.internal.ExceptionConstants; 59 60 69 public class PUTFIELD extends FieldInstruction implements ExceptionThrower{ 70 74 PUTFIELD() {} 75 76 public PUTFIELD(int index) { 77 super(Constants.PUTFIELD, index); 78 } 79 80 public int consumeStack(ConstantPoolGen cpg) { return getFieldSize(cpg) + 1; } 81 82 public Class [] getExceptions() { 83 Class [] cs = new Class [2 + ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length]; 84 85 System.arraycopy(ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION, 0, 86 cs, 0, ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length); 87 88 cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length+1] = 89 ExceptionConstants.INCOMPATIBLE_CLASS_CHANGE_ERROR; 90 cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length] = 91 ExceptionConstants.NULL_POINTER_EXCEPTION; 92 93 return cs; 94 } 95 96 97 105 public void accept(Visitor v) { 106 v.visitExceptionThrower(this); 107 v.visitTypedInstruction(this); 108 v.visitLoadClass(this); 109 v.visitCPInstruction(this); 110 v.visitFieldOrMethod(this); 111 v.visitFieldInstruction(this); 112 v.visitPUTFIELD(this); 113 } 114 } 115 | Popular Tags |