Skip to content

Commit b9ab895

Browse files
committed
Inferred generics for newSetFromMap arrangements
Issue: SPR-13188
1 parent e03dea1 commit b9ab895

File tree

14 files changed

+24
-37
lines changed

14 files changed

+24
-37
lines changed

spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAutoProxyCreator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public abstract class AbstractAutoProxyCreator extends ProxyProcessorSupport
129129
private BeanFactory beanFactory;
130130

131131
private final Set<String> targetSourcedBeans =
132-
Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>(16));
132+
Collections.newSetFromMap(new ConcurrentHashMap<>(16));
133133

134134
private final Set<Object> earlyProxyReferences =
135135
Collections.newSetFromMap(new ConcurrentHashMap<>(16));

spring-beans/src/main/java/org/springframework/beans/BeanUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public abstract class BeanUtils {
5858
private static final Log logger = LogFactory.getLog(BeanUtils.class);
5959

6060
private static final Set<Class<?>> unknownEditorTypes =
61-
Collections.newSetFromMap(new ConcurrentReferenceHashMap<Class<?>, Boolean>(64));
61+
Collections.newSetFromMap(new ConcurrentReferenceHashMap<>(64));
6262

6363

6464
/**

spring-beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public class CachedIntrospectionResults {
107107
* accept classes from, even if the classes do not qualify as cache-safe.
108108
*/
109109
static final Set<ClassLoader> acceptedClassLoaders =
110-
Collections.newSetFromMap(new ConcurrentHashMap<ClassLoader, Boolean>(16));
110+
Collections.newSetFromMap(new ConcurrentHashMap<>(16));
111111

112112
/**
113113
* Map keyed by Class containing CachedIntrospectionResults, strongly held.

spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,7 @@ public class AutowiredAnnotationBeanPostProcessor extends InstantiationAwareBean
119119

120120
protected final Log logger = LogFactory.getLog(getClass());
121121

122-
private final Set<Class<? extends Annotation>> autowiredAnnotationTypes =
123-
new LinkedHashSet<>();
122+
private final Set<Class<? extends Annotation>> autowiredAnnotationTypes = new LinkedHashSet<>();
124123

125124
private String requiredParameterName = "required";
126125

@@ -130,14 +129,11 @@ public class AutowiredAnnotationBeanPostProcessor extends InstantiationAwareBean
130129

131130
private ConfigurableListableBeanFactory beanFactory;
132131

133-
private final Set<String> lookupMethodsChecked =
134-
Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>(256));
132+
private final Set<String> lookupMethodsChecked = Collections.newSetFromMap(new ConcurrentHashMap<>(256));
135133

136-
private final Map<Class<?>, Constructor<?>[]> candidateConstructorsCache =
137-
new ConcurrentHashMap<>(256);
134+
private final Map<Class<?>, Constructor<?>[]> candidateConstructorsCache = new ConcurrentHashMap<>(256);
138135

139-
private final Map<String, InjectionMetadata> injectionMetadataCache =
140-
new ConcurrentHashMap<>(256);
136+
private final Map<String, InjectionMetadata> injectionMetadataCache = new ConcurrentHashMap<>(256);
141137

142138

143139
/**

spring-beans/src/main/java/org/springframework/beans/factory/annotation/RequiredAnnotationBeanPostProcessor.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,7 @@ public class RequiredAnnotationBeanPostProcessor extends InstantiationAwareBeanP
9393
/**
9494
* Cache for validated bean names, skipping re-validation for the same bean
9595
*/
96-
private final Set<String> validatedBeanNames =
97-
Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>(64));
96+
private final Set<String> validatedBeanNames = Collections.newSetFromMap(new ConcurrentHashMap<>(64));
9897

9998

10099
/**

spring-beans/src/main/java/org/springframework/beans/factory/config/PropertyOverrideConfigurer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -74,7 +74,7 @@ public class PropertyOverrideConfigurer extends PropertyResourceConfigurer {
7474
/**
7575
* Contains names of beans that have overrides
7676
*/
77-
private final Set<String> beanNames = Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>(16));
77+
private final Set<String> beanNames = Collections.newSetFromMap(new ConcurrentHashMap<>(16));
7878

7979

8080
/**

spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,10 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
160160
private SecurityContextProvider securityContextProvider;
161161

162162
/** Map from bean name to merged RootBeanDefinition */
163-
private final Map<String, RootBeanDefinition> mergedBeanDefinitions =
164-
new ConcurrentHashMap<>(256);
163+
private final Map<String, RootBeanDefinition> mergedBeanDefinitions = new ConcurrentHashMap<>(256);
165164

166165
/** Names of beans that have already been created at least once */
167-
private final Set<String> alreadyCreated =
168-
Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>(256));
166+
private final Set<String> alreadyCreated = Collections.newSetFromMap(new ConcurrentHashMap<>(256));
169167

170168
/** Names of beans that are currently in creation */
171169
private final ThreadLocal<Object> prototypesCurrentlyInCreation =

spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultSingletonBeanRegistry.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,11 @@ public class DefaultSingletonBeanRegistry extends SimpleAliasRegistry implements
9696

9797
/** Names of beans that are currently in creation */
9898
private final Set<String> singletonsCurrentlyInCreation =
99-
Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>(16));
99+
Collections.newSetFromMap(new ConcurrentHashMap<>(16));
100100

101101
/** Names of beans currently excluded from in creation checks */
102102
private final Set<String> inCreationCheckExclusions =
103-
Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>(16));
103+
Collections.newSetFromMap(new ConcurrentHashMap<>(16));
104104

105105
/** List of suppressed Exceptions, available for associating related causes */
106106
private Set<Exception> suppressedExceptions;

spring-context/src/main/java/org/springframework/context/event/EventListenerMethodProcessor.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ public class EventListenerMethodProcessor implements SmartInitializingSingleton,
6060

6161
private final EventExpressionEvaluator evaluator = new EventExpressionEvaluator();
6262

63-
private final Set<Class<?>> nonAnnotatedClasses =
64-
Collections.newSetFromMap(new ConcurrentHashMap<Class<?>, Boolean>(64));
63+
private final Set<Class<?>> nonAnnotatedClasses = Collections.newSetFromMap(new ConcurrentHashMap<>(64));
6564

6665

6766
@Override

spring-context/src/main/java/org/springframework/scheduling/annotation/ScheduledAnnotationBeanPostProcessor.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,9 @@ public class ScheduledAnnotationBeanPostProcessor implements DestructionAwareBea
109109

110110
private final ScheduledTaskRegistrar registrar = new ScheduledTaskRegistrar();
111111

112-
private final Set<Class<?>> nonAnnotatedClasses =
113-
Collections.newSetFromMap(new ConcurrentHashMap<Class<?>, Boolean>(64));
112+
private final Set<Class<?>> nonAnnotatedClasses = Collections.newSetFromMap(new ConcurrentHashMap<>(64));
114113

115-
private final Map<Object, Set<ScheduledTask>> scheduledTasks =
116-
new ConcurrentHashMap<>(16);
114+
private final Map<Object, Set<ScheduledTask>> scheduledTasks = new ConcurrentHashMap<>(16);
117115

118116

119117
@Override

0 commit comments

Comments
 (0)