From d90acdcedd63f04b906b0efc5e249e93245f5618 Mon Sep 17 00:00:00 2001 From: ehilsdal Date: Thu, 21 Aug 2003 16:02:53 +0000 Subject: [PATCH] Using correct patch for bug 39436 instead of vague one from email --- .../aspectj/weaver/bcel/LazyMethodGen.java | 53 +++++++++++-------- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java b/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java index 0d9db5bdf..a9ffd06db 100644 --- a/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java +++ b/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java @@ -256,10 +256,8 @@ public final class LazyMethodGen { LocalVariableGen lng = (LocalVariableGen) targeter; LocalVariableTag lr = new LocalVariableTag(BcelWorld.fromBcel(lng.getType()), lng.getName(), lng.getIndex()); if (lng.getStart() == ih) { - lng.setStart(null); locals.add(lr); } else { - lng.setEnd(null); ends.add(lr); } } @@ -835,15 +833,10 @@ public final class LazyMethodGen { } } else if (targeter instanceof LocalVariableTag) { LocalVariableTag lvt = (LocalVariableTag) targeter; - if (i instanceof LocalVariableInstruction) { - int index = ((LocalVariableInstruction)i).getIndex(); - if (lvt.getSlot() == index) { - if (localVariableStarts.get(lvt) == null) { - localVariableStarts.put(lvt, jh); - } - localVariableEnds.put(lvt, jh); - } - } + if (localVariableStarts.get(lvt) == null) { + localVariableStarts.put(lvt, jh); + } + localVariableEnds.put(lvt, jh); } } } @@ -852,7 +845,7 @@ public final class LazyMethodGen { jh = jh.getNext(); } } - + // now add exception handlers for (Iterator iter = exnList.iterator(); iter.hasNext();) { ExceptionRange r = (ExceptionRange) iter.next(); @@ -872,16 +865,34 @@ public final class LazyMethodGen { // remove them and add back to the gen. Map duplicatedLocalMap = new HashMap(); - + // Reverse sort these keys 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(); ) { + keys.addAll(localVariableStarts.keySet()); +// System.err.println("Keys for local variable tags"); +// for (int i = 0;i