CachedIntrospectionResults.clearClassLoader(null) removes cached classes for the system class loader
Issue: SPR-9189
This commit is contained in:
@@ -18,9 +18,8 @@ package org.springframework.beans;
|
||||
|
||||
import java.beans.BeanInfo;
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.core.OverridingClassLoader;
|
||||
@@ -37,7 +36,7 @@ import static org.junit.Assert.*;
|
||||
public final class CachedIntrospectionResultsTests {
|
||||
|
||||
@Test
|
||||
public void acceptClassLoader() throws Exception {
|
||||
public void acceptAndClearClassLoader() throws Exception {
|
||||
BeanWrapper bw = new BeanWrapperImpl(TestBean.class);
|
||||
assertTrue(bw.isWritableProperty("name"));
|
||||
assertTrue(bw.isWritableProperty("age"));
|
||||
@@ -57,6 +56,14 @@ public final class CachedIntrospectionResultsTests {
|
||||
assertTrue(CachedIntrospectionResults.classCache.containsKey(TestBean.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void clearClassLoaderForSystemClassLoader() throws Exception {
|
||||
BeanUtils.getPropertyDescriptors(ArrayList.class);
|
||||
assertTrue(CachedIntrospectionResults.classCache.containsKey(ArrayList.class));
|
||||
CachedIntrospectionResults.clearClassLoader(ArrayList.class.getClassLoader());
|
||||
assertFalse(CachedIntrospectionResults.classCache.containsKey(ArrayList.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldUseExtendedBeanInfoWhenApplicable() throws NoSuchMethodException, SecurityException {
|
||||
// given a class with a non-void returning setter method
|
||||
|
||||
Reference in New Issue
Block a user