I am running into a possible bug in the BCEL FieldInstruction class. I am working with an up to date copy of the trunk source code, and am getting a Java 1.5 runtime verification error complaining that the maximum stack depth of a method in a BCEL modified class is being exceeded. I traced the behavior to an incorrect "consume" value for a PUTFIELD Lobject; instruction in the constructor. The consume value is calculated using the getFieldSize function below. Based on the comment (and usage) the getFieldSize function should return a value of 1 or 2 words for the size of the value associated with the instruction. In this case the value should be 1 for an object reference. However, the Type.getTypeSize() function returns an encoded integer that contains the type size, and in this case the position of the closing ';'. Using this value directly results in an incorrect stack depth.
I have been testing a proposed modification to the getFieldSize method (shown below) that appears to fix the problem. Any feedback would be appreciated. Thanks. Peter /** @return size of field (1 or 2) */ protected int getFieldSize( ConstantPoolGen cpg ) { // return Type.getTypeSize(getSignature(cpg)); // original code return Type.getType(getSignature(cpg)).getSize(); // proposed modification } Peter Piela Director of Development peter.pi...@asg.com One Indian Head Plaza Nashua, NH 03060 USA Tel: 603.459.2416 Cell: 781.254.4153 ASG | www.asg.com Beyond BSM(tm) --------------------------------------------------------------------- To unsubscribe, e-mail: bcel-dev-unsubscr...@jakarta.apache.org For additional commands, e-mail: bcel-dev-h...@jakarta.apache.org