From 588e7b91e892db8db779142184ae3cad169c4a11 Mon Sep 17 00:00:00 2001 From: acolyer Date: Tue, 13 Dec 2005 22:23:24 +0000 Subject: fix for enh 120743 --- loadtime/src/org/aspectj/weaver/loadtime/Aj.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'loadtime') 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 -- cgit v1.2.3