From: aclement Date: Tue, 27 May 2008 18:52:24 +0000 (+0000) Subject: 210470: preventing weaver leaks: use a weak classloader ref X-Git-Tag: V1_6_1x~10 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=56e0a03e4cb6030fe980c546891214d557070bbd;p=aspectj.git 210470: preventing weaver leaks: use a weak classloader ref --- diff --git a/weaver/src/org/aspectj/weaver/tools/PointcutParser.java b/weaver/src/org/aspectj/weaver/tools/PointcutParser.java index 3d22f7aae..f6ff5ba03 100644 --- a/weaver/src/org/aspectj/weaver/tools/PointcutParser.java +++ b/weaver/src/org/aspectj/weaver/tools/PointcutParser.java @@ -28,6 +28,7 @@ import org.aspectj.weaver.IntMap; import org.aspectj.weaver.ResolvedType; import org.aspectj.weaver.Shadow; import org.aspectj.weaver.UnresolvedType; +import org.aspectj.weaver.WeakClassLoaderReference; import org.aspectj.weaver.World; import org.aspectj.weaver.bcel.AtAjAttributes; import org.aspectj.weaver.internal.tools.PointcutExpressionImpl; @@ -56,7 +57,7 @@ import org.aspectj.weaver.reflect.ReflectionWorld; public class PointcutParser { private ReflectionWorld world; - private ClassLoader classLoader; + private WeakClassLoaderReference classLoaderReference; private Set supportedPrimitives; private Set pointcutDesignators = new HashSet(); @@ -224,8 +225,8 @@ public class PointcutParser { * @param aLoader */ protected void setClassLoader(ClassLoader aLoader) { - this.classLoader = aLoader; - world = new ReflectionWorld(this.classLoader); + this.classLoaderReference = new WeakClassLoaderReference(aLoader); + world = new ReflectionWorld(this.classLoaderReference.getClassLoader()); } /** @@ -235,7 +236,7 @@ public class PointcutParser { * lint properties */ public void setLintProperties(String resourcePath)throws IOException { - URL url = this.classLoader.getResource(resourcePath); + URL url = this.classLoaderReference.getClassLoader().getResource(resourcePath); InputStream is = url.openStream(); Properties p = new Properties(); p.load(is);