diff options
author | ehilsdal <ehilsdal> | 2003-08-05 06:19:38 +0000 |
---|---|---|
committer | ehilsdal <ehilsdal> | 2003-08-05 06:19:38 +0000 |
commit | 137c47f0bdb7b7276ea3000a8d4d035f02b6eb68 (patch) | |
tree | bcb8959787f8927d0839d5bdabef7cdc434a15df /weaver | |
parent | e85783d87e6d499e9ef3591b6801631566ed8edc (diff) | |
download | aspectj-137c47f0bdb7b7276ea3000a8d4d035f02b6eb68.tar.gz aspectj-137c47f0bdb7b7276ea3000a8d4d035f02b6eb68.zip |
Fix for Bug 39470:
Repeating a compilation multiple times produces
class files that vary in size
Added a filter to make sure we don't add two local variable entries
with the same start and slot (BCEL workaround)
Diffstat (limited to 'weaver')
-rw-r--r-- | weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java b/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java index 569ac9793..7c4e660db 100644 --- a/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java +++ b/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java @@ -746,6 +746,7 @@ public final class LazyMethodGen { LinkedList exnList = new LinkedList(); + // map from localvariabletag to instruction handle Map localVariableStarts = new HashMap(); Map localVariableEnds = new HashMap(); @@ -849,8 +850,28 @@ public final class LazyMethodGen { } // now add local variables gen.removeLocalVariables(); + + // BCEL sometimes creates extra local variables with the same name. We now + // remove them and add back to the gen. + + Map duplicatedLocalMap = new HashMap(); + for (Iterator iter = localVariableStarts.keySet().iterator(); iter.hasNext(); ) { LocalVariableTag tag = (LocalVariableTag) iter.next(); + // have we already added one with the same slot number and start location? + // if so, just continue. + InstructionHandle start = (InstructionHandle) localVariableStarts.get(tag); + Set slots = (Set) duplicatedLocalMap.get(start); + if (slots == null) { + slots = new HashSet(); + duplicatedLocalMap.put(start, slots); + } + if (slots.contains(new Integer(tag.getSlot()))) { + // we already have a var starting at this tag with this slot + continue; + } + slots.add(new Integer(tag.getSlot())); + gen.addLocalVariable( tag.getName(), BcelWorld.makeBcelType(tag.getType()), |