switched from accessing field to an accessor method for access in tests.
Strangely, this fixes the broken tests in the continuous build.
This commit is contained in:
parent
5bc80cd693
commit
9c894c7485
|
@ -24,11 +24,10 @@ import java.lang.reflect.Constructor;
|
|||
*
|
||||
* @author Joel Leitch
|
||||
*/
|
||||
class DefaultConstructorAllocator {
|
||||
final class DefaultConstructorAllocator {
|
||||
private static final Constructor<Null> NULL_CONSTRUCTOR = createNullConstructor();
|
||||
|
||||
// Package private for testing purposes.
|
||||
final Cache<Class<?>, Constructor<?>> constructorCache;
|
||||
private final Cache<Class<?>, Constructor<?>> constructorCache;
|
||||
|
||||
public DefaultConstructorAllocator() {
|
||||
this(200);
|
||||
|
@ -38,6 +37,11 @@ class DefaultConstructorAllocator {
|
|||
constructorCache = new LruCache<Class<?>, Constructor<?>>(cacheSize);
|
||||
}
|
||||
|
||||
// for testing purpose
|
||||
final Cache<Class<?>, Constructor<?>> getConstructorCache() {
|
||||
return constructorCache;
|
||||
}
|
||||
|
||||
private static final Constructor<Null> createNullConstructor() {
|
||||
try {
|
||||
return getNoArgsConstructor(Null.class);
|
||||
|
|
|
@ -54,7 +54,7 @@ public class DefaultConstructorAllocatorTest extends TestCase {
|
|||
}
|
||||
|
||||
private void assertInCache(Class<?> clazz) {
|
||||
assertNotNull(allocator.constructorCache.getElement(clazz));
|
||||
assertNotNull(allocator.getConstructorCache().getElement(clazz));
|
||||
}
|
||||
|
||||
private static class NoDefaultConstructor {
|
||||
|
|
Loading…
Reference in New Issue
Block a user