]> source.dussan.org Git - aspectj.git/commitdiff
fix for pr153572 LTWWorld with Annotation finding and boot classes post_pr_153572
authoracolyer <acolyer>
Fri, 18 Aug 2006 14:51:00 +0000 (14:51 +0000)
committeracolyer <acolyer>
Fri, 18 Aug 2006 14:51:00 +0000 (14:51 +0000)
bcel-builder/src/org/aspectj/apache/bcel/util/ClassLoaderRepository.java
lib/bcel/bcel-src.zip
lib/bcel/bcel.jar
weaver/src/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegate.java
weaver5/java5-src/org/aspectj/weaver/reflect/Java15ReflectionBasedReferenceTypeDelegate.java

index 1c1f0c3595944f96dae6361bbb4147d7a5700ea4..6c30dade8bc70f4f53a5eb1f00967dac39eeb696 100644 (file)
@@ -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;
   }
 
   /**
index bf7670c8c46d70db9429d01325213824c59aa672..1d7d84805e76678cfd398a566b81678847a70951 100644 (file)
Binary files a/lib/bcel/bcel-src.zip and b/lib/bcel/bcel-src.zip differ
index 5bcbec16bbc1ea78d42c7ece19438ed025581e05..493ffe6a2a13e8251ca6094502c99d6c3f329d19 100644 (file)
Binary files a/lib/bcel/bcel.jar and b/lib/bcel/bcel.jar differ
index ba208c751a806fce14dbcf68e32ccc094cdbe632..bc0ca7bfd0ed5dff8fa79b9a7417338f24d9a322 100644 (file)
@@ -15,6 +15,8 @@ import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
 import java.lang.reflect.Member;
 import java.lang.reflect.Method;
+import java.net.URL;
+import java.net.URLClassLoader;
 import java.util.Collection;
 import java.util.Collections;
 
@@ -40,6 +42,8 @@ import org.aspectj.weaver.patterns.PerClause;
  */
 public class ReflectionBasedReferenceTypeDelegate implements ReferenceTypeDelegate {
 
+       private static final ClassLoader BootClassLoader = new URLClassLoader(new URL[0]);
+       
        protected Class myClass = null;
        protected ClassLoader classLoader = null;
        private World world;
@@ -59,7 +63,7 @@ public class ReflectionBasedReferenceTypeDelegate implements ReferenceTypeDelega
                this.myClass = aClass;
                this.resolvedType = aType;
                this.world = aWorld;
-               this.classLoader = aClassLoader;
+               this.classLoader = (aClassLoader != null) ? aClassLoader : BootClassLoader;
        }
        
        protected Class getBaseClass() { 
index b6156fc5cfbd40000a27bfa7022b81c6f6279f6d..b5d63d7d1ee44c877a5cf5859a55a1f31872257e 100644 (file)
@@ -63,7 +63,7 @@ public class Java15ReflectionBasedReferenceTypeDelegate extends
                myType = AjTypeSystem.getAjType(aClass);
                annotationFinder = new Java15AnnotationFinder();
                argNameFinder = annotationFinder;
-               annotationFinder.setClassLoader(classLoader);
+               annotationFinder.setClassLoader(this.classLoader);
                this.typeConverter = new JavaLangTypeToResolvedTypeConverter(aWorld);
        }