@@ -76,7 +76,7 @@ public class CachedIntrospectionResults {
76
76
* Needs to be a WeakHashMap with WeakReferences as values to allow
77
77
* for proper garbage collection in case of multiple class loaders.
78
78
*/
79
- static final Map <Class , Object > classCache = new WeakHashMap <Class , Object >();
79
+ static final Map <Class <?> , Object > classCache = new WeakHashMap <Class <?> , Object >();
80
80
81
81
82
82
/**
@@ -107,7 +107,7 @@ public static void acceptClassLoader(ClassLoader classLoader) {
107
107
*/
108
108
public static void clearClassLoader (ClassLoader classLoader ) {
109
109
synchronized (classCache ) {
110
- for (Iterator <Class > it = classCache .keySet ().iterator (); it .hasNext ();) {
110
+ for (Iterator <Class <?> > it = classCache .keySet ().iterator (); it .hasNext ();) {
111
111
Class <?> beanClass = it .next ();
112
112
if (isUnderneathClassLoader (beanClass .getClassLoader (), classLoader )) {
113
113
it .remove ();
@@ -130,15 +130,16 @@ public static void clearClassLoader(ClassLoader classLoader) {
130
130
* @return the corresponding CachedIntrospectionResults
131
131
* @throws BeansException in case of introspection failure
132
132
*/
133
+ @ SuppressWarnings ("unchecked" )
133
134
static CachedIntrospectionResults forClass (Class <?> beanClass ) throws BeansException {
134
135
CachedIntrospectionResults results ;
135
136
Object value ;
136
137
synchronized (classCache ) {
137
138
value = classCache .get (beanClass );
138
139
}
139
140
if (value instanceof Reference ) {
140
- Reference ref = (Reference ) value ;
141
- results = ( CachedIntrospectionResults ) ref .get ();
141
+ Reference < CachedIntrospectionResults > ref = (Reference < CachedIntrospectionResults > ) value ;
142
+ results = ref .get ();
142
143
}
143
144
else {
144
145
results = (CachedIntrospectionResults ) value ;
@@ -260,8 +261,9 @@ private CachedIntrospectionResults(Class<?> beanClass) throws BeansException {
260
261
// This call is slow so we do it once.
261
262
PropertyDescriptor [] pds = this .beanInfo .getPropertyDescriptors ();
262
263
for (PropertyDescriptor pd : pds ) {
263
- if (Class .class .equals (beanClass ) && "classLoader" .equals (pd .getName ())) {
264
- // Ignore Class.getClassLoader() method - nobody needs to bind to that
264
+ if (Class .class .equals (beanClass ) &&
265
+ ("classLoader" .equals (pd .getName ()) || "protectionDomain" .equals (pd .getName ()))) {
266
+ // Ignore Class.getClassLoader() and getProtectionDomain() methods - nobody needs to bind to those
265
267
continue ;
266
268
}
267
269
if (logger .isTraceEnabled ()) {
0 commit comments