Inferred generics for newSetFromMap arrangements

Issue: SPR-13188
This commit is contained in:
Juergen Hoeller 2016-07-26 21:26:31 +02:00
parent e03dea1d64
commit b9ab895743
14 changed files with 24 additions and 37 deletions

View File

@ -129,7 +129,7 @@ public abstract class AbstractAutoProxyCreator extends ProxyProcessorSupport
private BeanFactory beanFactory; private BeanFactory beanFactory;
private final Set<String> targetSourcedBeans = private final Set<String> targetSourcedBeans =
Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>(16)); Collections.newSetFromMap(new ConcurrentHashMap<>(16));
private final Set<Object> earlyProxyReferences = private final Set<Object> earlyProxyReferences =
Collections.newSetFromMap(new ConcurrentHashMap<>(16)); Collections.newSetFromMap(new ConcurrentHashMap<>(16));

View File

@ -58,7 +58,7 @@ public abstract class BeanUtils {
private static final Log logger = LogFactory.getLog(BeanUtils.class); private static final Log logger = LogFactory.getLog(BeanUtils.class);
private static final Set<Class<?>> unknownEditorTypes = private static final Set<Class<?>> unknownEditorTypes =
Collections.newSetFromMap(new ConcurrentReferenceHashMap<Class<?>, Boolean>(64)); Collections.newSetFromMap(new ConcurrentReferenceHashMap<>(64));
/** /**

View File

@ -107,7 +107,7 @@ public class CachedIntrospectionResults {
* accept classes from, even if the classes do not qualify as cache-safe. * accept classes from, even if the classes do not qualify as cache-safe.
*/ */
static final Set<ClassLoader> acceptedClassLoaders = static final Set<ClassLoader> acceptedClassLoaders =
Collections.newSetFromMap(new ConcurrentHashMap<ClassLoader, Boolean>(16)); Collections.newSetFromMap(new ConcurrentHashMap<>(16));
/** /**
* Map keyed by Class containing CachedIntrospectionResults, strongly held. * Map keyed by Class containing CachedIntrospectionResults, strongly held.

View File

@ -119,8 +119,7 @@ public class AutowiredAnnotationBeanPostProcessor extends InstantiationAwareBean
protected final Log logger = LogFactory.getLog(getClass()); protected final Log logger = LogFactory.getLog(getClass());
private final Set<Class<? extends Annotation>> autowiredAnnotationTypes = private final Set<Class<? extends Annotation>> autowiredAnnotationTypes = new LinkedHashSet<>();
new LinkedHashSet<>();
private String requiredParameterName = "required"; private String requiredParameterName = "required";
@ -130,14 +129,11 @@ public class AutowiredAnnotationBeanPostProcessor extends InstantiationAwareBean
private ConfigurableListableBeanFactory beanFactory; private ConfigurableListableBeanFactory beanFactory;
private final Set<String> lookupMethodsChecked = private final Set<String> lookupMethodsChecked = Collections.newSetFromMap(new ConcurrentHashMap<>(256));
Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>(256));
private final Map<Class<?>, Constructor<?>[]> candidateConstructorsCache = private final Map<Class<?>, Constructor<?>[]> candidateConstructorsCache = new ConcurrentHashMap<>(256);
new ConcurrentHashMap<>(256);
private final Map<String, InjectionMetadata> injectionMetadataCache = private final Map<String, InjectionMetadata> injectionMetadataCache = new ConcurrentHashMap<>(256);
new ConcurrentHashMap<>(256);
/** /**

View File

@ -93,8 +93,7 @@ public class RequiredAnnotationBeanPostProcessor extends InstantiationAwareBeanP
/** /**
* Cache for validated bean names, skipping re-validation for the same bean * Cache for validated bean names, skipping re-validation for the same bean
*/ */
private final Set<String> validatedBeanNames = private final Set<String> validatedBeanNames = Collections.newSetFromMap(new ConcurrentHashMap<>(64));
Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>(64));
/** /**

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2013 the original author or authors. * Copyright 2002-2016 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -74,7 +74,7 @@ public class PropertyOverrideConfigurer extends PropertyResourceConfigurer {
/** /**
* Contains names of beans that have overrides * Contains names of beans that have overrides
*/ */
private final Set<String> beanNames = Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>(16)); private final Set<String> beanNames = Collections.newSetFromMap(new ConcurrentHashMap<>(16));
/** /**

View File

@ -160,12 +160,10 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
private SecurityContextProvider securityContextProvider; private SecurityContextProvider securityContextProvider;
/** Map from bean name to merged RootBeanDefinition */ /** Map from bean name to merged RootBeanDefinition */
private final Map<String, RootBeanDefinition> mergedBeanDefinitions = private final Map<String, RootBeanDefinition> mergedBeanDefinitions = new ConcurrentHashMap<>(256);
new ConcurrentHashMap<>(256);
/** Names of beans that have already been created at least once */ /** Names of beans that have already been created at least once */
private final Set<String> alreadyCreated = private final Set<String> alreadyCreated = Collections.newSetFromMap(new ConcurrentHashMap<>(256));
Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>(256));
/** Names of beans that are currently in creation */ /** Names of beans that are currently in creation */
private final ThreadLocal<Object> prototypesCurrentlyInCreation = private final ThreadLocal<Object> prototypesCurrentlyInCreation =

View File

@ -96,11 +96,11 @@ public class DefaultSingletonBeanRegistry extends SimpleAliasRegistry implements
/** Names of beans that are currently in creation */ /** Names of beans that are currently in creation */
private final Set<String> singletonsCurrentlyInCreation = private final Set<String> singletonsCurrentlyInCreation =
Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>(16)); Collections.newSetFromMap(new ConcurrentHashMap<>(16));
/** Names of beans currently excluded from in creation checks */ /** Names of beans currently excluded from in creation checks */
private final Set<String> inCreationCheckExclusions = private final Set<String> inCreationCheckExclusions =
Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>(16)); Collections.newSetFromMap(new ConcurrentHashMap<>(16));
/** List of suppressed Exceptions, available for associating related causes */ /** List of suppressed Exceptions, available for associating related causes */
private Set<Exception> suppressedExceptions; private Set<Exception> suppressedExceptions;

View File

@ -60,8 +60,7 @@ public class EventListenerMethodProcessor implements SmartInitializingSingleton,
private final EventExpressionEvaluator evaluator = new EventExpressionEvaluator(); private final EventExpressionEvaluator evaluator = new EventExpressionEvaluator();
private final Set<Class<?>> nonAnnotatedClasses = private final Set<Class<?>> nonAnnotatedClasses = Collections.newSetFromMap(new ConcurrentHashMap<>(64));
Collections.newSetFromMap(new ConcurrentHashMap<Class<?>, Boolean>(64));
@Override @Override

View File

@ -109,11 +109,9 @@ public class ScheduledAnnotationBeanPostProcessor implements DestructionAwareBea
private final ScheduledTaskRegistrar registrar = new ScheduledTaskRegistrar(); private final ScheduledTaskRegistrar registrar = new ScheduledTaskRegistrar();
private final Set<Class<?>> nonAnnotatedClasses = private final Set<Class<?>> nonAnnotatedClasses = Collections.newSetFromMap(new ConcurrentHashMap<>(64));
Collections.newSetFromMap(new ConcurrentHashMap<Class<?>, Boolean>(64));
private final Map<Object, Set<ScheduledTask>> scheduledTasks = private final Map<Object, Set<ScheduledTask>> scheduledTasks = new ConcurrentHashMap<>(16);
new ConcurrentHashMap<>(16);
@Override @Override

View File

@ -38,11 +38,9 @@ public abstract class DecoratingClassLoader extends ClassLoader {
} }
private final Set<String> excludedPackages = private final Set<String> excludedPackages = Collections.newSetFromMap(new ConcurrentHashMap<>(8));
Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>(8));
private final Set<String> excludedClasses = private final Set<String> excludedClasses = Collections.newSetFromMap(new ConcurrentHashMap<>(8));
Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>(8));
/** /**

View File

@ -82,7 +82,7 @@ public abstract class StatementCreatorUtils {
static final boolean shouldIgnoreGetParameterType = SpringProperties.getFlag(IGNORE_GETPARAMETERTYPE_PROPERTY_NAME); static final boolean shouldIgnoreGetParameterType = SpringProperties.getFlag(IGNORE_GETPARAMETERTYPE_PROPERTY_NAME);
static final Set<String> driversWithNoSupportForGetParameterType = static final Set<String> driversWithNoSupportForGetParameterType =
Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>(1)); Collections.newSetFromMap(new ConcurrentHashMap<>(1));
private static final Log logger = LogFactory.getLog(StatementCreatorUtils.class); private static final Log logger = LogFactory.getLog(StatementCreatorUtils.class);

View File

@ -99,14 +99,14 @@ public class JmsListenerAnnotationBeanPostProcessor
private StringValueResolver embeddedValueResolver; private StringValueResolver embeddedValueResolver;
private final MessageHandlerMethodFactoryAdapter messageHandlerMethodFactory = new MessageHandlerMethodFactoryAdapter(); private final MessageHandlerMethodFactoryAdapter messageHandlerMethodFactory =
new MessageHandlerMethodFactoryAdapter();
private final JmsListenerEndpointRegistrar registrar = new JmsListenerEndpointRegistrar(); private final JmsListenerEndpointRegistrar registrar = new JmsListenerEndpointRegistrar();
private final AtomicInteger counter = new AtomicInteger(); private final AtomicInteger counter = new AtomicInteger();
private final Set<Class<?>> nonAnnotatedClasses = private final Set<Class<?>> nonAnnotatedClasses = Collections.newSetFromMap(new ConcurrentHashMap<>(64));
Collections.newSetFromMap(new ConcurrentHashMap<Class<?>, Boolean>(64));
@Override @Override

View File

@ -51,8 +51,7 @@ public class SessionAttributesHandler {
private final Set<Class<?>> attributeTypes = new HashSet<>(); private final Set<Class<?>> attributeTypes = new HashSet<>();
private final Set<String> knownAttributeNames = private final Set<String> knownAttributeNames = Collections.newSetFromMap(new ConcurrentHashMap<>(4));
Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>(4));
private final SessionAttributeStore sessionAttributeStore; private final SessionAttributeStore sessionAttributeStore;