From: acolyer Date: Tue, 13 Dec 2005 22:23:24 +0000 (+0000) Subject: fix for enh 120743 X-Git-Tag: V1_5_0RC1~6 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=588e7b91e892db8db779142184ae3cad169c4a11;p=aspectj.git fix for enh 120743 --- diff --git a/loadtime/src/org/aspectj/weaver/loadtime/Aj.java b/loadtime/src/org/aspectj/weaver/loadtime/Aj.java index c5818e208..fd045c3e6 100644 --- a/loadtime/src/org/aspectj/weaver/loadtime/Aj.java +++ b/loadtime/src/org/aspectj/weaver/loadtime/Aj.java @@ -59,6 +59,9 @@ public class Aj implements ClassPreProcessor { try { WeavingAdaptor weavingAdaptor = WeaverContainer.getWeaver(loader, weavingContext); + if (weavingAdaptor == null) { + return bytes; + } return weavingAdaptor.weaveClass(className, bytes); } catch (Throwable t) { //FIXME AV wondering if we should have the option to fail (throw runtime exception) here @@ -81,11 +84,17 @@ public class Aj implements ClassPreProcessor { synchronized(weavingAdaptors) { adaptor = (ExplicitlyInitializedClassLoaderWeavingAdaptor) weavingAdaptors.get(loader); if (adaptor == null) { - // create it and put it back in the weavingAdaptors map but avoid any kind of instantiation - // within the synchronized block - ClassLoaderWeavingAdaptor weavingAdaptor = new ClassLoaderWeavingAdaptor(loader, weavingContext); - adaptor = new ExplicitlyInitializedClassLoaderWeavingAdaptor(weavingAdaptor); - weavingAdaptors.put(loader, adaptor); + String loaderClassName = loader.getClass().getName(); + if (loaderClassName.equals("sun.reflect.DelegatingClassLoader")) { + // we don't weave reflection generated types at all! + return null; + } else { + // create it and put it back in the weavingAdaptors map but avoid any kind of instantiation + // within the synchronized block + ClassLoaderWeavingAdaptor weavingAdaptor = new ClassLoaderWeavingAdaptor(loader, weavingContext); + adaptor = new ExplicitlyInitializedClassLoaderWeavingAdaptor(weavingAdaptor); + weavingAdaptors.put(loader, adaptor); + } } } // perform the initialization