Ignore classloaders which are inner classes when doing implicit bootdelegation (FELIX-2421).

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@955734 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/ModuleImpl.java b/framework/src/main/java/org/apache/felix/framework/ModuleImpl.java
index 9f48f5d..62bd70e 100644
--- a/framework/src/main/java/org/apache/felix/framework/ModuleImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/ModuleImpl.java
@@ -1517,8 +1517,13 @@
         // If this is an inner class, try to get the enclosing class
         // because we can assume that inner classes of class loaders
         // are really just the class loader and we should ignore them.
-        clazz = getEnclosingClass(clazz);
-        return (this.getClass().getClassLoader() != clazz.getClassLoader())
+        Class enclosing = getEnclosingClass(clazz);
+        return (this.getClass().getClassLoader() != enclosing.getClassLoader())
+            // Do the test on the enclosing class
+            && !ClassLoader.class.isAssignableFrom(enclosing)
+            && !Class.class.equals(enclosing)
+            && !Proxy.class.equals(enclosing)
+            // Do the test on the class itself
             && !ClassLoader.class.isAssignableFrom(clazz)
             && !Class.class.equals(clazz)
             && !Proxy.class.equals(clazz);