]> source.dussan.org Git - aspectj.git/commitdiff
Still patching for bug 39470 (patch devised by Andy, vetted by me).
authorehilsdal <ehilsdal>
Wed, 20 Aug 2003 22:25:01 +0000 (22:25 +0000)
committerehilsdal <ehilsdal>
Wed, 20 Aug 2003 22:25:01 +0000 (22:25 +0000)
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.

weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java

index dd011f6c307af16772086f31cc1b730551c4cdc8..0d9db5bdfc055d8277ae2b9d302890e54cfdc15f 100644 (file)
@@ -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.