diff options
author | acolyer <acolyer> | 2006-08-18 14:51:00 +0000 |
---|---|---|
committer | acolyer <acolyer> | 2006-08-18 14:51:00 +0000 |
commit | 135173acd2c893e5bfbb420e9cccf493ba150bfe (patch) | |
tree | c2bdbeb9b1548827b0f616b2bed8a4360877cb5c /bcel-builder | |
parent | 9b03811333687b7a41baa1b9c9ff84344df86bbc (diff) | |
download | aspectj-135173acd2c893e5bfbb420e9cccf493ba150bfe.tar.gz aspectj-135173acd2c893e5bfbb420e9cccf493ba150bfe.zip |
fix for pr153572 LTWWorld with Annotation finding and boot classespost_pr_153572
Diffstat (limited to 'bcel-builder')
-rw-r--r-- | bcel-builder/src/org/aspectj/apache/bcel/util/ClassLoaderRepository.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/util/ClassLoaderRepository.java b/bcel-builder/src/org/aspectj/apache/bcel/util/ClassLoaderRepository.java index 1c1f0c359..6c30dade8 100644 --- a/bcel-builder/src/org/aspectj/apache/bcel/util/ClassLoaderRepository.java +++ b/bcel-builder/src/org/aspectj/apache/bcel/util/ClassLoaderRepository.java @@ -59,6 +59,7 @@ import java.io.InputStream; import java.lang.ref.Reference; import java.lang.ref.SoftReference; import java.net.URL; +import java.net.URLClassLoader; import java.util.HashMap; import java.util.Map; import java.util.WeakHashMap; @@ -75,11 +76,12 @@ import org.aspectj.apache.bcel.classfile.JavaClass; * * @see org.aspectj.apache.bcel.Repository * - * @version $Id: ClassLoaderRepository.java,v 1.6 2006/08/08 11:26:28 aclement Exp $ + * @version $Id: ClassLoaderRepository.java,v 1.7 2006/08/18 14:51:00 acolyer Exp $ * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A> * @author David Dixon-Peugh */ public class ClassLoaderRepository implements Repository { + private static java.lang.ClassLoader bootClassLoader = null; private java.lang.ClassLoader loader; private WeakHashMap /*<String classname,JavaClass>*/loadedClassesLocalCache = new WeakHashMap(); private static Map /*<URL,JavaClass>*/loadedUrlsSharedCache = new HashMap(); @@ -99,7 +101,14 @@ public class ClassLoaderRepository implements Repository { } public ClassLoaderRepository( java.lang.ClassLoader loader ) { - this.loader = loader; + this.loader = (loader != null) ? loader : getBootClassLoader(); + } + + private static synchronized java.lang.ClassLoader getBootClassLoader() { + if (bootClassLoader == null) { + bootClassLoader = new URLClassLoader(new URL[0]); + } + return bootClassLoader; } /** |