From 9030415d5741f7d4ac96cd055e860c7760d93d37 Mon Sep 17 00:00:00 2001 From: aclement Date: Mon, 16 Oct 2006 09:20:27 +0000 Subject: [PATCH] moved things around so that Xset can change world configuration --- .../src/org/aspectj/systemtest/ajc153/ajc153.xml | 2 +- weaver/src/org/aspectj/weaver/World.java | 1 + .../src/org/aspectj/weaver/bcel/BcelWorld.java | 16 ++++++++++++---- weaver/src/org/aspectj/weaver/ltw/LTWWorld.java | 1 + 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml b/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml index 27b7effc1..b428413d6 100644 --- a/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml +++ b/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml @@ -131,8 +131,8 @@ - + diff --git a/weaver/src/org/aspectj/weaver/World.java b/weaver/src/org/aspectj/weaver/World.java index fb5fe193b..da29f249b 100644 --- a/weaver/src/org/aspectj/weaver/World.java +++ b/weaver/src/org/aspectj/weaver/World.java @@ -775,6 +775,7 @@ public abstract class World implements Dump.INode { extraConfiguration.setProperty(n,v); } } + ensureAdvancedConfigurationProcessed(); } /** diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java b/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java index 5dfeba271..bee6f126e 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java @@ -85,6 +85,7 @@ public class BcelWorld extends World implements Repository { private ClassPathManager classPath; protected Repository delegate; + private ClassLoader loader; //private ClassPathManager aspectPath = null; @@ -153,15 +154,20 @@ public class BcelWorld extends World implements Repository { */ public BcelWorld(ClassLoader loader, IMessageHandler handler, ICrossReferenceHandler xrefHandler) { this.classPath = null; + this.loader = loader; setMessageHandler(handler); setCrossReferenceHandler(xrefHandler); // Tell BCEL to use us for resolving any classes - delegate = getClassLoaderRepositoryFor(loader); - // TODO Alex do we need to call org.aspectj.apache.bcel.Repository.setRepository(delegate); - // if so, how can that be safe in J2EE ?? (static stuff in Bcel) + // delegate = getClassLoaderRepositoryFor(loader); + } + + public void ensureRepositorySetup() { + if (delegate==null) { + delegate = getClassLoaderRepositoryFor(loader); + } } - public Repository getClassLoaderRepositoryFor(ClassLoader loader) { + public Repository getClassLoaderRepositoryFor(ClassLoader loader) { if (bcelRepositoryCaching) { return new ClassLoaderRepository(loader); } else { @@ -360,6 +366,7 @@ public class BcelWorld extends World implements Repository { private JavaClass lookupJavaClass(ClassPathManager classPath, String name) { if (classPath == null) { try { + ensureRepositorySetup(); JavaClass jc = delegate.loadClass(name); if (trace.isTraceEnabled()) trace.event("lookupJavaClass",this,new Object[] { name, jc }); return jc; @@ -863,4 +870,5 @@ public class BcelWorld extends World implements Repository { decpToRepeat = decpToRepeatNextTime; } } + } \ No newline at end of file diff --git a/weaver/src/org/aspectj/weaver/ltw/LTWWorld.java b/weaver/src/org/aspectj/weaver/ltw/LTWWorld.java index a89dc6f77..439584ee9 100644 --- a/weaver/src/org/aspectj/weaver/ltw/LTWWorld.java +++ b/weaver/src/org/aspectj/weaver/ltw/LTWWorld.java @@ -246,6 +246,7 @@ public class LTWWorld extends BcelWorld implements IReflectionWorld { } public void storeClass(JavaClass clazz) { + ensureRepositorySetup(); delegate.storeClass(clazz); } -- 2.39.5