From 1b54b4b7555176c8548dbbffded063191ad0b46a Mon Sep 17 00:00:00 2001 From: aclement Date: Fri, 6 Feb 2009 00:15:57 +0000 Subject: [PATCH] 263837: make reweavable field in BcelClassWeaver non-static --- .../aspectj/weaver/bcel/BcelClassWeaver.java | 17 +++++++++-------- .../org/aspectj/weaver/bcel/BcelTypeMunger.java | 2 +- .../src/org/aspectj/weaver/bcel/BcelWeaver.java | 8 ++------ 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java b/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java index 940cef5e2..8d1ad6f8a 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java @@ -94,9 +94,13 @@ class BcelClassWeaver implements IClassWeaver { /** * This is called from {@link BcelWeaver} to perform the per-class weaving process. + * */ - public static boolean weave(BcelWorld world, LazyClassGen clazz, List shadowMungers, List typeMungers, List lateTypeMungers) { - boolean b = new BcelClassWeaver(world, clazz, shadowMungers, typeMungers, lateTypeMungers).weave(); + public static boolean weave(BcelWorld world, LazyClassGen clazz, List shadowMungers, List typeMungers, List lateTypeMungers, + boolean inReweavableMode) { + BcelClassWeaver classWeaver = new BcelClassWeaver(world, clazz, shadowMungers, typeMungers, lateTypeMungers); + classWeaver.setReweavableMode(inReweavableMode); + boolean b = classWeaver.weave(); // System.out.println(clazz.getClassName() + ", " + // clazz.getType().getWeaverState()); // clazz.print(); @@ -118,8 +122,7 @@ class BcelClassWeaver implements IClassWeaver { private final List addedLazyMethodGens = new ArrayList(); private final Set addedDispatchTargets = new HashSet(); - // Static setting across BcelClassWeavers - private static boolean inReweavableMode = false; + private boolean inReweavableMode = false; private List addedSuperInitializersAsList = null; // List private final Map addedSuperInitializers = new HashMap(); // Interface -> @@ -3070,13 +3073,11 @@ class BcelClassWeaver implements IClassWeaver { return world; } - // Called by the BcelWeaver to let us know all BcelClassWeavers need to - // collect reweavable info - public static void setReweavableMode(boolean mode) { + public void setReweavableMode(boolean mode) { inReweavableMode = mode; } - public static boolean getReweavableMode() { + public boolean getReweavableMode() { return inReweavableMode; } diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java b/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java index 3a50e7c76..97d462b12 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java @@ -116,7 +116,7 @@ public class BcelTypeMunger extends ConcreteTypeMunger { } if (changed && munger.changesPublicSignature()) { - WeaverStateInfo info = weaver.getLazyClassGen().getOrCreateWeaverStateInfo(BcelClassWeaver.getReweavableMode()); + WeaverStateInfo info = weaver.getLazyClassGen().getOrCreateWeaverStateInfo(weaver.getReweavableMode()); info.addConcreteMunger(this); } diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java b/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java index 7ba56af66..f5298dd11 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java @@ -1729,7 +1729,8 @@ public class BcelWeaver { boolean isChanged = false; if (mightNeedToWeave) - isChanged = BcelClassWeaver.weave(world, clazz, shadowMungers, typeMungers, lateTypeMungerList); + isChanged = BcelClassWeaver.weave(world, clazz, shadowMungers, typeMungers, lateTypeMungerList, + inReweavableMode); if (mightNeedBridgeMethods) isChanged = BcelClassWeaver.calculateAnyRequiredBridgeMethods(world, clazz) || isChanged; @@ -1841,13 +1842,8 @@ public class BcelWeaver { } public void setReweavableMode(boolean xNotReweavable) { - if (trace.isTraceEnabled()) - trace.enter("setReweavableMode", this, xNotReweavable); inReweavableMode = !xNotReweavable; WeaverStateInfo.setReweavableModeDefaults(!xNotReweavable, false, true); - BcelClassWeaver.setReweavableMode(!xNotReweavable); - if (trace.isTraceEnabled()) - trace.exit("setReweavableMode"); } public boolean isReweavable() { -- 2.39.5