From 51632439ca42fc130148eaa8715d406416fdda6d Mon Sep 17 00:00:00 2001 From: aclement Date: Thu, 17 Nov 2011 21:20:07 +0000 Subject: [PATCH] 363962 --- .../org/aspectj/weaver/WeakClassLoaderReference.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/WeakClassLoaderReference.java b/org.aspectj.matcher/src/org/aspectj/weaver/WeakClassLoaderReference.java index bcf650286..ddca93202 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/WeakClassLoaderReference.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/WeakClassLoaderReference.java @@ -30,9 +30,9 @@ import java.lang.ref.WeakReference; * be using this weaver if its associated ClassLoader has been collected. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=210470 * * - * @author Andy Clement + * @author Andy Clement, Abraham Nevado */ -public class WeakClassLoaderReference { +public class WeakClassLoaderReference{ protected final int hashcode; @@ -40,7 +40,13 @@ public class WeakClassLoaderReference { public WeakClassLoaderReference(ClassLoader loader) { loaderRef = new WeakReference(loader); - hashcode = loader.hashCode() * 37; + if(loader == null){ + // Bug: 363962 + // Check that ClassLoader is not null, for instance when loaded from BootStrapClassLoader + hashcode = System.identityHashCode(this); + }else{ + hashcode = loader.hashCode() * 37; + } } public ClassLoader getClassLoader() { -- 2.39.5