diff options
author | ehilsdal <ehilsdal> | 2004-01-29 13:46:27 +0000 |
---|---|---|
committer | ehilsdal <ehilsdal> | 2004-01-29 13:46:27 +0000 |
commit | f5f74fd0bf1770273998aa3010c524a29dccd520 (patch) | |
tree | c9c5404e78c4ca897c7401ed984dc07710b582a5 /weaver | |
parent | bece4680e604416148871e60cef77f0cd0808aba (diff) | |
download | aspectj-f5f74fd0bf1770273998aa3010c524a29dccd520.tar.gz aspectj-f5f74fd0bf1770273998aa3010c524a29dccd520.zip |
Fix for Bugzilla Bug 41125:
LocalVariableTable sometimes gets BCEL-supplied parameter names
Diffstat (limited to 'weaver')
-rw-r--r-- | weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java | 39 |
1 files changed, 6 insertions, 33 deletions
diff --git a/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java b/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java index 8cb337b35..d3c8dc0b0 100644 --- a/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java +++ b/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java @@ -17,8 +17,6 @@ import java.io.ByteArrayOutputStream; import java.io.PrintStream; import java.lang.reflect.Modifier; import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; @@ -54,9 +52,7 @@ import org.aspectj.bridge.IMessage; import org.aspectj.weaver.AjAttribute; import org.aspectj.weaver.BCException; import org.aspectj.weaver.ISourceContext; -import org.aspectj.weaver.Member; import org.aspectj.weaver.ResolvedTypeX; -import org.aspectj.weaver.TypeX; /** @@ -915,38 +911,15 @@ 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. + + // this next iteration _might_ be overkill, but we had problems with + // bcel before with duplicate local variables. Now that we're patching + // bcel we should be able to do without it if we're paranoid enough + // through the rest of the compiler. Map duplicatedLocalMap = new HashMap(); - // Reverse sort these keys - List keys = new ArrayList(); + List keys = new ArrayList(); keys.addAll(localVariableStarts.keySet()); -// System.err.println("Keys for local variable tags"); -// for (int i = 0;i <keys.size();i++) { -// System.err.println("Before sort: #"+i+"="+keys.get(i)); -// } - Collections.sort(keys, new Comparator() { - public int compare(Object a, Object b) { - LocalVariableTag taga = (LocalVariableTag) a; - LocalVariableTag tagb = (LocalVariableTag) b; - if (taga.getName().startsWith("arg")) { - if (tagb.getName().startsWith("arg")) { - return -taga.getName().compareTo(tagb.getName()); - } else { - return 1; // Whatever tagb is, it must come out before 'arg' - } - } else if (tagb.getName().startsWith("arg")) { - return -1; // Whatever taga is, it must come out before 'arg' - } else { - return -taga.getName().compareTo(tagb.getName()); - } - } - }); -// for (int i = 0;i <keys.size();i++) { -// System.err.println("After sort: #"+i+"="+keys.get(i)); -// } for (Iterator iter = keys.iterator(); iter.hasNext(); ) { LocalVariableTag tag = (LocalVariableTag) iter.next(); // have we already added one with the same slot number and start location? |