From 1c2077ea4994f8d268f89a1c85d482d82f97f876 Mon Sep 17 00:00:00 2001 From: ehilsdal Date: Wed, 20 Aug 2003 22:25:01 +0000 Subject: [PATCH] Still patching for bug 39470 (patch devised by Andy, vetted by me). Sorting the local variables so we can deal with the fact that BCEL generates extra local variables and doesn't bother to make them hashable. --- .../src/org/aspectj/weaver/bcel/LazyMethodGen.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java b/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java index dd011f6c3..0d9db5bdf 100644 --- a/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java +++ b/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java @@ -17,6 +17,8 @@ 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; @@ -871,7 +873,15 @@ public final class LazyMethodGen { Map duplicatedLocalMap = new HashMap(); - for (Iterator iter = localVariableStarts.keySet().iterator(); iter.hasNext(); ) { + List keys = new ArrayList(); + keys.addAll(localVariableStarts.keySet()); + Collections.sort(keys,new Comparator() { + public int compare(Object a,Object b) { + LocalVariableTag taga = (LocalVariableTag)a; + LocalVariableTag tagb = (LocalVariableTag)b; + return taga.getName().compareTo(tagb.getName()); + }}); + 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? // if so, just continue. -- 2.39.5