aboutsummaryrefslogtreecommitdiffstats
path: root/bcel-builder
diff options
context:
space:
mode:
authoracolyer <acolyer>2005-09-27 21:08:24 +0000
committeracolyer <acolyer>2005-09-27 21:08:24 +0000
commit97520cf015afa87263c9497b4a60888ba2ada177 (patch)
treee0f226881520969d3afdcda2966db705f82a0ba2 /bcel-builder
parentfb428d0e5ad8adabc14049f8a170b30d57044588 (diff)
downloadaspectj-97520cf015afa87263c9497b4a60888ba2ada177.tar.gz
aspectj-97520cf015afa87263c9497b4a60888ba2ada177.zip
fix for pr101407 - weaver produces wrong local variable table bytecode.
Diffstat (limited to 'bcel-builder')
-rw-r--r--bcel-builder/src/org/aspectj/apache/bcel/generic/LocalVariableGen.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/LocalVariableGen.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/LocalVariableGen.java
index 7791e6662..f181e8c9d 100644
--- a/bcel-builder/src/org/aspectj/apache/bcel/generic/LocalVariableGen.java
+++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/LocalVariableGen.java
@@ -63,7 +63,7 @@ import org.aspectj.apache.bcel.classfile.LocalVariable;
* with getLocalVariable which needs the instruction list and the constant
* pool as parameters.
*
- * @version $Id: LocalVariableGen.java,v 1.3 2004/11/22 08:31:27 aclement Exp $
+ * @version $Id: LocalVariableGen.java,v 1.4 2005/09/27 21:08:24 acolyer Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
* @see LocalVariable
* @see MethodGen
@@ -118,8 +118,15 @@ public class LocalVariableGen
int start_pc = start.getPosition();
int length = end.getPosition() - start_pc;
- if(length > 0)
+ if(length > 0) {
length += end.getInstruction().getLength();
+ // AMC - the above calculation is off by one. The spec says that the variable
+ // must have a range from start pos to start pos + length INCLUSIVE.
+ // but the calculation above puts start pos + length as the address of
+ // the first instruction outside of the range.
+ // So we need to subtract 1... which gives the very end of the last inst in the range
+ length = length - 1;
+ }
int name_index = cp.addUtf8(name);
int signature_index = cp.addUtf8(type.getSignature());