Use diamond type

This commit is contained in:
Johnny Lim 2017-11-20 02:25:30 +09:00 committed by Rob Winch
parent cfe40358bd
commit 57353d18e5
221 changed files with 423 additions and 428 deletions

View File

@ -52,7 +52,7 @@ public class AclPermissionCacheOptimizer implements PermissionCacheOptimizer {
return;
}
List<ObjectIdentity> oidsToCache = new ArrayList<ObjectIdentity>(objects.size());
List<ObjectIdentity> oidsToCache = new ArrayList<>(objects.size());
for (Object domainObject : objects) {
if (domainObject == null) {

View File

@ -52,7 +52,7 @@ class ArrayFilterer<T> implements Filterer<T> {
// Collect the removed objects to a HashSet so that
// it is fast to lookup them when a filtered array
// is constructed.
removeList = new HashSet<T>();
removeList = new HashSet<>();
}
// ~ Methods

View File

@ -56,7 +56,7 @@ class CollectionFilterer<T> implements Filterer<T> {
// to the method may not necessarily be re-constructable (as
// the Collection(collection) constructor is not guaranteed and
// manually adding may lose sort order or other capabilities)
removeList = new HashSet<T>();
removeList = new HashSet<>();
}
// ~ Methods

View File

@ -44,7 +44,7 @@ public class AclImpl implements Acl, MutableAcl, AuditableAcl, OwnershipAcl {
private Acl parentAcl;
private transient AclAuthorizationStrategy aclAuthorizationStrategy;
private transient PermissionGrantingStrategy permissionGrantingStrategy;
private final List<AccessControlEntry> aces = new ArrayList<AccessControlEntry>();
private final List<AccessControlEntry> aces = new ArrayList<>();
private ObjectIdentity objectIdentity;
private Serializable id;
private Sid owner; // OwnershipAcl
@ -173,7 +173,7 @@ public class AclImpl implements Acl, MutableAcl, AuditableAcl, OwnershipAcl {
public List<AccessControlEntry> getEntries() {
// Can safely return AccessControlEntry directly, as they're immutable outside the
// ACL package
return new ArrayList<AccessControlEntry>(aces);
return new ArrayList<>(aces);
}
@Override

View File

@ -38,8 +38,8 @@ import org.springframework.util.Assert;
* @since 2.0.3
*/
public class DefaultPermissionFactory implements PermissionFactory {
private final Map<Integer, Permission> registeredPermissionsByInteger = new HashMap<Integer, Permission>();
private final Map<String, Permission> registeredPermissionsByName = new HashMap<String, Permission>();
private final Map<Integer, Permission> registeredPermissionsByInteger = new HashMap<>();
private final Map<String, Permission> registeredPermissionsByName = new HashMap<>();
/**
* Registers the <tt>Permission</tt> fields from the <tt>BasePermission</tt> class.
@ -156,7 +156,7 @@ public class DefaultPermissionFactory implements PermissionFactory {
return Collections.emptyList();
}
List<Permission> permissions = new ArrayList<Permission>(names.size());
List<Permission> permissions = new ArrayList<>(names.size());
for (String name : names) {
permissions.add(buildFromName(name));

View File

@ -57,7 +57,7 @@ public class SidRetrievalStrategyImpl implements SidRetrievalStrategy {
public List<Sid> getSids(Authentication authentication) {
Collection<? extends GrantedAuthority> authorities = roleHierarchy
.getReachableGrantedAuthorities(authentication.getAuthorities());
List<Sid> sids = new ArrayList<Sid>(authorities.size() + 1);
List<Sid> sids = new ArrayList<>(authorities.size() + 1);
sids.add(new PrincipalSid(authentication));

View File

@ -291,13 +291,13 @@ public class BasicLookupStrategy implements LookupStrategy {
Assert.notEmpty(objects, "Objects to lookup required");
// Map<ObjectIdentity,Acl>
Map<ObjectIdentity, Acl> result = new HashMap<ObjectIdentity, Acl>(); // contains
Map<ObjectIdentity, Acl> result = new HashMap<>(); // contains
// FULLY
// loaded
// Acl
// objects
Set<ObjectIdentity> currentBatchToLoad = new HashSet<ObjectIdentity>();
Set<ObjectIdentity> currentBatchToLoad = new HashSet<>();
for (int i = 0; i < objects.size(); i++) {
final ObjectIdentity oid = objects.get(i);
@ -371,7 +371,7 @@ public class BasicLookupStrategy implements LookupStrategy {
final Collection<ObjectIdentity> objectIdentities, List<Sid> sids) {
Assert.notEmpty(objectIdentities, "Must provide identities to lookup");
final Map<Serializable, Acl> acls = new HashMap<Serializable, Acl>(); // contains
final Map<Serializable, Acl> acls = new HashMap<>(); // contains
// Acls
// with
// StubAclParents
@ -408,7 +408,7 @@ public class BasicLookupStrategy implements LookupStrategy {
}
// Finally, convert our "acls" containing StubAclParents into true Acls
Map<ObjectIdentity, Acl> resultMap = new HashMap<ObjectIdentity, Acl>();
Map<ObjectIdentity, Acl> resultMap = new HashMap<>();
for (Acl inputAcl : acls.values()) {
Assert.isInstanceOf(AclImpl.class, inputAcl,
@ -463,7 +463,7 @@ public class BasicLookupStrategy implements LookupStrategy {
List<AccessControlEntryImpl> aces = readAces(inputAcl);
// Create a list in which to store the "aces" for the "result" AclImpl instance
List<AccessControlEntryImpl> acesNew = new ArrayList<AccessControlEntryImpl>();
List<AccessControlEntryImpl> acesNew = new ArrayList<>();
// Iterate over the "aces" input and replace each nested
// AccessControlEntryImpl.getAcl() with the new "result" AclImpl instance
@ -581,7 +581,7 @@ public class BasicLookupStrategy implements LookupStrategy {
* @throws SQLException
*/
public Set<Long> extractData(ResultSet rs) throws SQLException {
Set<Long> parentIdsToLookup = new HashSet<Long>(); // Set of parent_id Longs
Set<Long> parentIdsToLookup = new HashSet<>(); // Set of parent_id Longs
while (rs.next()) {
// Convert current row into an Acl (albeit with a StubAclParent)

View File

@ -237,13 +237,13 @@ public class AclImplTests {
true, new PrincipalSid("joe"));
Sid ben = new PrincipalSid("ben");
try {
acl.isGranted(new ArrayList<Permission>(0), Arrays.asList(ben), false);
acl.isGranted(new ArrayList<>(0), Arrays.asList(ben), false);
fail("It should have thrown IllegalArgumentException");
}
catch (IllegalArgumentException expected) {
}
try {
acl.isGranted(READ, new ArrayList<Sid>(0), false);
acl.isGranted(READ, new ArrayList<>(0), false);
fail("It should have thrown IllegalArgumentException");
}
catch (IllegalArgumentException expected) {
@ -500,7 +500,7 @@ public class AclImplTests {
.isTrue();
assertThat(acl.isSidLoaded(BEN)).isTrue();
assertThat(acl.isSidLoaded(null)).isTrue();
assertThat(acl.isSidLoaded(new ArrayList<Sid>(0))).isTrue();
assertThat(acl.isSidLoaded(new ArrayList<>(0))).isTrue();
assertThat(acl.isSidLoaded(Arrays.asList((Sid) new GrantedAuthoritySid(
"ROLE_IGNORED"), new GrantedAuthoritySid("ROLE_IGNORED"))))
.isTrue();

View File

@ -55,7 +55,7 @@ public class JdbcAclServiceTests {
// SEC-1898
@Test(expected = NotFoundException.class)
public void readAclByIdMissingAcl() {
Map<ObjectIdentity, Acl> result = new HashMap<ObjectIdentity, Acl>();
Map<ObjectIdentity, Acl> result = new HashMap<>();
when(
lookupStrategy.readAclsById(anyListOf(ObjectIdentity.class),
anyListOf(Sid.class))).thenReturn(result);

View File

@ -206,7 +206,7 @@ class PrePostSecured {
@PostFilter("filterObject.startsWith('a')")
public List<String> postFilterMethod() {
ArrayList<String> objects = new ArrayList<String>();
ArrayList<String> objects = new ArrayList<>();
objects.addAll(Arrays.asList(new String[] { "apple", "banana", "aubergine",
"orange" }));
return objects;

View File

@ -19,7 +19,6 @@ import java.util.ArrayList;
import org.jasig.cas.client.validation.Assertion;
import org.springframework.security.authentication.AbstractAuthenticationToken;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.SpringSecurityCoreVersion;
/**
@ -37,7 +36,7 @@ public final class CasAssertionAuthenticationToken extends AbstractAuthenticatio
private final String ticket;
public CasAssertionAuthenticationToken(final Assertion assertion, final String ticket) {
super(new ArrayList<GrantedAuthority>());
super(new ArrayList<>());
this.assertion = assertion;
this.ticket = ticket;

View File

@ -54,7 +54,7 @@ public final class GrantedAuthorityFromAssertionAttributesUserDetailsService ext
@SuppressWarnings("unchecked")
@Override
protected UserDetails loadUserDetails(final Assertion assertion) {
final List<GrantedAuthority> grantedAuthorities = new ArrayList<GrantedAuthority>();
final List<GrantedAuthority> grantedAuthorities = new ArrayList<>();
for (final String attribute : this.attributes) {
final Object value = assertion.getPrincipal().getAttributes().get(attribute);

View File

@ -33,7 +33,7 @@ import org.springframework.security.core.userdetails.User;
public abstract class AbstractStatelessTicketCacheTests {
protected CasAuthenticationToken getToken() {
List<String> proxyList = new ArrayList<String>();
List<String> proxyList = new ArrayList<>();
proxyList.add("https://localhost/newPortal/login/cas");
User user = new User("rod", "password", true, true, true, true,

View File

@ -392,7 +392,7 @@ public class CasAuthenticationProviderTests {
}
private class MockStatelessTicketCache implements StatelessTicketCache {
private Map<String, CasAuthenticationToken> cache = new HashMap<String, CasAuthenticationToken>();
private Map<String, CasAuthenticationToken> cache = new HashMap<>();
public CasAuthenticationToken getByTicketId(String serviceTicket) {
return cache.get(serviceTicket);

View File

@ -44,7 +44,7 @@ public class GrantedAuthorityFromAssertionAttributesUserDetailsServiceTests {
uds.setConvertToUpperCase(false);
Assertion assertion = mock(Assertion.class);
AttributePrincipal principal = mock(AttributePrincipal.class);
Map<String, Object> attributes = new HashMap<String, Object>();
Map<String, Object> attributes = new HashMap<>();
attributes.put("a", Arrays.asList("role_a1", "role_a2"));
attributes.put("b", "role_b");
attributes.put("c", "role_c");

View File

@ -60,7 +60,7 @@ public final class SecurityNamespaceHandler implements NamespaceHandler {
private static final String FILTER_CHAIN_PROXY_CLASSNAME = "org.springframework.security.web.FilterChainProxy";
private static final String MESSAGE_CLASSNAME = "org.springframework.messaging.Message";
private final Log logger = LogFactory.getLog(getClass());
private final Map<String, BeanDefinitionParser> parsers = new HashMap<String, BeanDefinitionParser>();
private final Map<String, BeanDefinitionParser> parsers = new HashMap<>();
private final BeanDefinitionDecorator interceptMethodsBDD = new InterceptMethodsBeanDefinitionDecorator();
private BeanDefinitionDecorator filterChainMapBDD;

View File

@ -220,9 +220,9 @@ public abstract class AbstractConfiguredSecurityBuilder<O, B extends SecurityBui
public <C extends SecurityConfigurer<O, B>> List<C> getConfigurers(Class<C> clazz) {
List<C> configs = (List<C>) this.configurers.get(clazz);
if (configs == null) {
return new ArrayList<C>();
return new ArrayList<>();
}
return new ArrayList<C>(configs);
return new ArrayList<>(configs);
}
/**
@ -236,9 +236,9 @@ public abstract class AbstractConfiguredSecurityBuilder<O, B extends SecurityBui
public <C extends SecurityConfigurer<O, B>> List<C> removeConfigurers(Class<C> clazz) {
List<C> configs = (List<C>) this.configurers.remove(clazz);
if (configs == null) {
return new ArrayList<C>();
return new ArrayList<>();
}
return new ArrayList<C>(configs);
return new ArrayList<>(configs);
}
/**
@ -459,4 +459,4 @@ public abstract class AbstractConfiguredSecurityBuilder<O, B extends SecurityBui
return order >= CONFIGURING.order;
}
}
}
}

View File

@ -54,7 +54,7 @@ public class AuthenticationManagerBuilder
private final Log logger = LogFactory.getLog(getClass());
private AuthenticationManager parentAuthenticationManager;
private List<AuthenticationProvider> authenticationProviders = new ArrayList<AuthenticationProvider>();
private List<AuthenticationProvider> authenticationProviders = new ArrayList<>();
private UserDetailsService defaultUserDetailsService;
private Boolean eraseCredentials;
private AuthenticationEventPublisher eventPublisher;
@ -131,7 +131,7 @@ public class AuthenticationManagerBuilder
*/
public InMemoryUserDetailsManagerConfigurer<AuthenticationManagerBuilder> inMemoryAuthentication()
throws Exception {
return apply(new InMemoryUserDetailsManagerConfigurer<AuthenticationManagerBuilder>());
return apply(new InMemoryUserDetailsManagerConfigurer<>());
}
/**
@ -161,7 +161,7 @@ public class AuthenticationManagerBuilder
*/
public JdbcUserDetailsManagerConfigurer<AuthenticationManagerBuilder> jdbcAuthentication()
throws Exception {
return apply(new JdbcUserDetailsManagerConfigurer<AuthenticationManagerBuilder>());
return apply(new JdbcUserDetailsManagerConfigurer<>());
}
/**
@ -184,7 +184,7 @@ public class AuthenticationManagerBuilder
public <T extends UserDetailsService> DaoAuthenticationConfigurer<AuthenticationManagerBuilder, T> userDetailsService(
T userDetailsService) throws Exception {
this.defaultUserDetailsService = userDetailsService;
return apply(new DaoAuthenticationConfigurer<AuthenticationManagerBuilder, T>(
return apply(new DaoAuthenticationConfigurer<>(
userDetailsService));
}
@ -203,7 +203,7 @@ public class AuthenticationManagerBuilder
*/
public LdapAuthenticationProviderConfigurer<AuthenticationManagerBuilder> ldapAuthentication()
throws Exception {
return apply(new LdapAuthenticationProviderConfigurer<AuthenticationManagerBuilder>());
return apply(new LdapAuthenticationProviderConfigurer<>());
}
/**
@ -289,4 +289,4 @@ public class AuthenticationManagerBuilder
this.defaultUserDetailsService = configurer.getUserDetailsService();
return (C) super.apply(configurer);
}
}
}

View File

@ -18,7 +18,6 @@ package org.springframework.security.config.annotation.authentication.configurer
import java.util.ArrayList;
import org.springframework.security.config.annotation.authentication.ProviderManagerBuilder;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.provisioning.InMemoryUserDetailsManager;
/**
@ -39,6 +38,6 @@ public class InMemoryUserDetailsManagerConfigurer<B extends ProviderManagerBuild
* Creates a new instance
*/
public InMemoryUserDetailsManagerConfigurer() {
super(new InMemoryUserDetailsManager(new ArrayList<UserDetails>()));
super(new InMemoryUserDetailsManager(new ArrayList<>()));
}
}

View File

@ -49,7 +49,7 @@ public class JdbcUserDetailsManagerConfigurer<B extends ProviderManagerBuilder<B
private DataSource dataSource;
private List<Resource> initScripts = new ArrayList<Resource>();
private List<Resource> initScripts = new ArrayList<>();
public JdbcUserDetailsManagerConfigurer(JdbcUserDetailsManager manager) {
super(manager);

View File

@ -41,7 +41,7 @@ import org.springframework.security.provisioning.UserDetailsManager;
public class UserDetailsManagerConfigurer<B extends ProviderManagerBuilder<B>, C extends UserDetailsManagerConfigurer<B, C>>
extends UserDetailsServiceConfigurer<B, C, UserDetailsManager> {
private final List<UserDetailsBuilder> userBuilders = new ArrayList<UserDetailsBuilder>();
private final List<UserDetailsBuilder> userBuilders = new ArrayList<>();
private final List<UserDetails> users = new ArrayList<>();

View File

@ -41,8 +41,8 @@ final class AutowireBeanFactoryObjectPostProcessor
implements ObjectPostProcessor<Object>, DisposableBean, SmartInitializingSingleton {
private final Log logger = LogFactory.getLog(getClass());
private final AutowireCapableBeanFactory autowireBeanFactory;
private final List<DisposableBean> disposableBeans = new ArrayList<DisposableBean>();
private final List<SmartInitializingSingleton> smartSingletons = new ArrayList<SmartInitializingSingleton>();
private final List<DisposableBean> disposableBeans = new ArrayList<>();
private final List<SmartInitializingSingleton> smartSingletons = new ArrayList<>();
public AutowireBeanFactoryObjectPostProcessor(
AutowireCapableBeanFactory autowireBeanFactory) {

View File

@ -213,7 +213,7 @@ public class GlobalMethodSecurityConfiguration
getExpressionHandler());
PostInvocationAdviceProvider postInvocationAdviceProvider = new PostInvocationAdviceProvider(
postAdvice);
List<AfterInvocationProvider> afterInvocationProviders = new ArrayList<AfterInvocationProvider>();
List<AfterInvocationProvider> afterInvocationProviders = new ArrayList<>();
afterInvocationProviders.add(postInvocationAdviceProvider);
invocationProviderManager.setProviders(afterInvocationProviders);
return invocationProviderManager;
@ -350,7 +350,7 @@ public class GlobalMethodSecurityConfiguration
*/
@Bean
public MethodSecurityMetadataSource methodSecurityMetadataSource() {
List<MethodSecurityMetadataSource> sources = new ArrayList<MethodSecurityMetadataSource>();
List<MethodSecurityMetadataSource> sources = new ArrayList<>();
ExpressionBasedAnnotationAttributeFactory attributeFactory = new ExpressionBasedAnnotationAttributeFactory(
getExpressionHandler());
MethodSecurityMetadataSource customMethodSecurityMetadataSource = customMethodSecurityMetadataSource();

View File

@ -61,7 +61,7 @@ final class GlobalMethodSecuritySelector implements ImportSelector {
boolean jsr250Enabled = attributes.getBoolean("jsr250Enabled");
List<String> classNames = new ArrayList<String>(4);
List<String> classNames = new ArrayList<>(4);
if(isProxy) {
classNames.add(MethodSecurityMetadataSourceAdvisorRegistrar.class.getName());
}

View File

@ -169,7 +169,7 @@ public abstract class AbstractRequestMatcherRegistry<C> {
}
HandlerMappingIntrospector introspector = this.context.getBean(HANDLER_MAPPING_INTROSPECTOR_BEAN_NAME,
HandlerMappingIntrospector.class);
List<MvcRequestMatcher> matchers = new ArrayList<MvcRequestMatcher>(
List<MvcRequestMatcher> matchers = new ArrayList<>(
mvcPatterns.length);
for (String mvcPattern : mvcPatterns) {
MvcRequestMatcher matcher = new MvcRequestMatcher(introspector, mvcPattern);
@ -257,7 +257,7 @@ public abstract class AbstractRequestMatcherRegistry<C> {
public static List<RequestMatcher> antMatchers(HttpMethod httpMethod,
String... antPatterns) {
String method = httpMethod == null ? null : httpMethod.toString();
List<RequestMatcher> matchers = new ArrayList<RequestMatcher>();
List<RequestMatcher> matchers = new ArrayList<>();
for (String pattern : antPatterns) {
matchers.add(new AntPathRequestMatcher(pattern, method));
}
@ -290,7 +290,7 @@ public abstract class AbstractRequestMatcherRegistry<C> {
public static List<RequestMatcher> regexMatchers(HttpMethod httpMethod,
String... regexPatterns) {
String method = httpMethod == null ? null : httpMethod.toString();
List<RequestMatcher> matchers = new ArrayList<RequestMatcher>();
List<RequestMatcher> matchers = new ArrayList<>();
for (String pattern : regexPatterns) {
matchers.add(new RegexRequestMatcher(pattern, method));
}

View File

@ -57,7 +57,7 @@ import org.springframework.web.filter.CorsFilter;
@SuppressWarnings("serial")
final class FilterComparator implements Comparator<Filter>, Serializable {
private static final int STEP = 100;
private Map<String, Integer> filterToOrder = new HashMap<String, Integer>();
private Map<String, Integer> filterToOrder = new HashMap<>();
FilterComparator() {
int order = 100;

View File

@ -119,7 +119,7 @@ public final class HttpSecurity extends
implements SecurityBuilder<DefaultSecurityFilterChain>,
HttpSecurityBuilder<HttpSecurity> {
private final RequestMatcherConfigurer requestMatcherConfigurer;
private List<Filter> filters = new ArrayList<Filter>();
private List<Filter> filters = new ArrayList<>();
private RequestMatcher requestMatcher = AnyRequestMatcher.INSTANCE;
private FilterComparator comparator = new FilterComparator();
@ -232,7 +232,7 @@ public final class HttpSecurity extends
* @see OpenIDLoginConfigurer
*/
public OpenIDLoginConfigurer<HttpSecurity> openidLogin() throws Exception {
return getOrApply(new OpenIDLoginConfigurer<HttpSecurity>());
return getOrApply(new OpenIDLoginConfigurer<>());
}
/**
@ -332,7 +332,7 @@ public final class HttpSecurity extends
* @see HeadersConfigurer
*/
public HeadersConfigurer<HttpSecurity> headers() throws Exception {
return getOrApply(new HeadersConfigurer<HttpSecurity>());
return getOrApply(new HeadersConfigurer<>());
}
/**
@ -345,7 +345,7 @@ public final class HttpSecurity extends
* @throws Exception
*/
public CorsConfigurer<HttpSecurity> cors() throws Exception {
return getOrApply(new CorsConfigurer<HttpSecurity>());
return getOrApply(new CorsConfigurer<>());
}
/**
@ -397,7 +397,7 @@ public final class HttpSecurity extends
* @throws Exception
*/
public SessionManagementConfigurer<HttpSecurity> sessionManagement() throws Exception {
return getOrApply(new SessionManagementConfigurer<HttpSecurity>());
return getOrApply(new SessionManagementConfigurer<>());
}
/**
@ -440,7 +440,7 @@ public final class HttpSecurity extends
* @see #requiresChannel()
*/
public PortMapperConfigurer<HttpSecurity> portMapper() throws Exception {
return getOrApply(new PortMapperConfigurer<HttpSecurity>());
return getOrApply(new PortMapperConfigurer<>());
}
/**
@ -512,7 +512,7 @@ public final class HttpSecurity extends
* @throws Exception
*/
public JeeConfigurer<HttpSecurity> jee() throws Exception {
return getOrApply(new JeeConfigurer<HttpSecurity>());
return getOrApply(new JeeConfigurer<>());
}
/**
@ -542,7 +542,7 @@ public final class HttpSecurity extends
* @throws Exception
*/
public X509Configurer<HttpSecurity> x509() throws Exception {
return getOrApply(new X509Configurer<HttpSecurity>());
return getOrApply(new X509Configurer<>());
}
/**
@ -579,7 +579,7 @@ public final class HttpSecurity extends
* @throws Exception
*/
public RememberMeConfigurer<HttpSecurity> rememberMe() throws Exception {
return getOrApply(new RememberMeConfigurer<HttpSecurity>());
return getOrApply(new RememberMeConfigurer<>());
}
/**
@ -649,7 +649,7 @@ public final class HttpSecurity extends
public ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry authorizeRequests()
throws Exception {
ApplicationContext context = getContext();
return getOrApply(new ExpressionUrlAuthorizationConfigurer<HttpSecurity>(context))
return getOrApply(new ExpressionUrlAuthorizationConfigurer<>(context))
.getRegistry();
}
@ -664,7 +664,7 @@ public final class HttpSecurity extends
* @throws Exception
*/
public RequestCacheConfigurer<HttpSecurity> requestCache() throws Exception {
return getOrApply(new RequestCacheConfigurer<HttpSecurity>());
return getOrApply(new RequestCacheConfigurer<>());
}
/**
@ -675,7 +675,7 @@ public final class HttpSecurity extends
* @throws Exception
*/
public ExceptionHandlingConfigurer<HttpSecurity> exceptionHandling() throws Exception {
return getOrApply(new ExceptionHandlingConfigurer<HttpSecurity>());
return getOrApply(new ExceptionHandlingConfigurer<>());
}
/**
@ -687,7 +687,7 @@ public final class HttpSecurity extends
* @throws Exception
*/
public SecurityContextConfigurer<HttpSecurity> securityContext() throws Exception {
return getOrApply(new SecurityContextConfigurer<HttpSecurity>());
return getOrApply(new SecurityContextConfigurer<>());
}
/**
@ -699,7 +699,7 @@ public final class HttpSecurity extends
* @throws Exception
*/
public ServletApiConfigurer<HttpSecurity> servletApi() throws Exception {
return getOrApply(new ServletApiConfigurer<HttpSecurity>());
return getOrApply(new ServletApiConfigurer<>());
}
/**
@ -726,7 +726,7 @@ public final class HttpSecurity extends
*/
public CsrfConfigurer<HttpSecurity> csrf() throws Exception {
ApplicationContext context = getContext();
return getOrApply(new CsrfConfigurer<HttpSecurity>(context));
return getOrApply(new CsrfConfigurer<>(context));
}
/**
@ -767,7 +767,7 @@ public final class HttpSecurity extends
* @throws Exception
*/
public LogoutConfigurer<HttpSecurity> logout() throws Exception {
return getOrApply(new LogoutConfigurer<HttpSecurity>());
return getOrApply(new LogoutConfigurer<>());
}
/**
@ -830,7 +830,7 @@ public final class HttpSecurity extends
* @throws Exception
*/
public AnonymousConfigurer<HttpSecurity> anonymous() throws Exception {
return getOrApply(new AnonymousConfigurer<HttpSecurity>());
return getOrApply(new AnonymousConfigurer<>());
}
/**
@ -894,7 +894,7 @@ public final class HttpSecurity extends
* @throws Exception
*/
public FormLoginConfigurer<HttpSecurity> formLogin() throws Exception {
return getOrApply(new FormLoginConfigurer<HttpSecurity>());
return getOrApply(new FormLoginConfigurer<>());
}
/**
@ -988,7 +988,7 @@ public final class HttpSecurity extends
* @throws Exception
*/
public OAuth2LoginConfigurer<HttpSecurity> oauth2Login() throws Exception {
return getOrApply(new OAuth2LoginConfigurer<HttpSecurity>());
return getOrApply(new OAuth2LoginConfigurer<>());
}
/**
@ -1028,7 +1028,7 @@ public final class HttpSecurity extends
public ChannelSecurityConfigurer<HttpSecurity>.ChannelRequestMatcherRegistry requiresChannel()
throws Exception {
ApplicationContext context = getContext();
return getOrApply(new ChannelSecurityConfigurer<HttpSecurity>(context))
return getOrApply(new ChannelSecurityConfigurer<>(context))
.getRegistry();
}
@ -1062,7 +1062,7 @@ public final class HttpSecurity extends
* @throws Exception
*/
public HttpBasicConfigurer<HttpSecurity> httpBasic() throws Exception {
return getOrApply(new HttpBasicConfigurer<HttpSecurity>());
return getOrApply(new HttpBasicConfigurer<>());
}
public <C> void setSharedObject(Class<C> sharedType, C object) {
@ -1382,7 +1382,7 @@ public final class HttpSecurity extends
private MvcMatchersRequestMatcherConfigurer(ApplicationContext context,
List<MvcRequestMatcher> matchers) {
super(context);
this.matchers = new ArrayList<RequestMatcher>(matchers);
this.matchers = new ArrayList<>(matchers);
}
public RequestMatcherConfigurer servletPath(String servletPath) {
@ -1403,7 +1403,7 @@ public final class HttpSecurity extends
public class RequestMatcherConfigurer
extends AbstractRequestMatcherRegistry<RequestMatcherConfigurer> {
protected List<RequestMatcher> matchers = new ArrayList<RequestMatcher>();
protected List<RequestMatcher> matchers = new ArrayList<>();
/**
* @param context

View File

@ -79,7 +79,7 @@ public final class WebSecurity extends
SecurityBuilder<Filter>, ApplicationContextAware {
private final Log logger = LogFactory.getLog(getClass());
private final List<RequestMatcher> ignoredRequests = new ArrayList<RequestMatcher>();
private final List<RequestMatcher> ignoredRequests = new ArrayList<>();
private final List<SecurityBuilder<? extends SecurityFilterChain>> securityFilterChainBuilders = new ArrayList<SecurityBuilder<? extends SecurityFilterChain>>();
@ -281,7 +281,7 @@ public final class WebSecurity extends
+ WebSecurity.class.getSimpleName()
+ ".addSecurityFilterChainBuilder directly");
int chainSize = ignoredRequests.size() + securityFilterChainBuilders.size();
List<SecurityFilterChain> securityFilterChains = new ArrayList<SecurityFilterChain>(
List<SecurityFilterChain> securityFilterChains = new ArrayList<>(
chainSize);
for (RequestMatcher ignoredRequest : ignoredRequests) {
securityFilterChains.add(new DefaultSecurityFilterChain(ignoredRequest));

View File

@ -216,7 +216,7 @@ public abstract class WebSecurityConfigurerAdapter implements
.requestCache().and()
.anonymous().and()
.servletApi().and()
.apply(new DefaultLoginPageConfigurer<HttpSecurity>()).and()
.apply(new DefaultLoginPageConfigurer<>()).and()
.logout();
// @formatter:on
ClassLoader classLoader = this.context.getClassLoader();
@ -517,7 +517,7 @@ public abstract class WebSecurityConfigurerAdapter implements
String[] beanNamesForType = BeanFactoryUtils
.beanNamesForTypeIncludingAncestors(applicationContext,
AuthenticationManager.class);
return new HashSet<String>(Arrays.asList(beanNamesForType));
return new HashSet<>(Arrays.asList(beanNamesForType));
}
private static void validateBeanCycle(Object auth, Set<String> beanNames) {

View File

@ -39,7 +39,7 @@ import org.springframework.security.web.util.matcher.RequestMatcher;
*/
public abstract class AbstractConfigAttributeRequestMatcherRegistry<C> extends
AbstractRequestMatcherRegistry<C> {
private List<UrlMapping> urlMappings = new ArrayList<UrlMapping>();
private List<UrlMapping> urlMappings = new ArrayList<>();
private List<RequestMatcher> unmappedMatchers;
/**

View File

@ -80,7 +80,7 @@ public final class CsrfConfigurer<H extends HttpSecurityBuilder<H>>
private CsrfTokenRepository csrfTokenRepository = new LazyCsrfTokenRepository(
new HttpSessionCsrfTokenRepository());
private RequestMatcher requireCsrfProtectionMatcher = CsrfFilter.DEFAULT_CSRF_MATCHER;
private List<RequestMatcher> ignoredCsrfProtectionMatchers = new ArrayList<RequestMatcher>();
private List<RequestMatcher> ignoredCsrfProtectionMatchers = new ArrayList<>();
private final ApplicationContext context;
/**
@ -327,4 +327,4 @@ public final class CsrfConfigurer<H extends HttpSecurityBuilder<H>>
return this;
}
}
}
}

View File

@ -68,7 +68,7 @@ public final class ExceptionHandlingConfigurer<H extends HttpSecurityBuilder<H>>
private AccessDeniedHandler accessDeniedHandler;
private LinkedHashMap<RequestMatcher, AuthenticationEntryPoint> defaultEntryPointMappings = new LinkedHashMap<RequestMatcher, AuthenticationEntryPoint>();
private LinkedHashMap<RequestMatcher, AuthenticationEntryPoint> defaultEntryPointMappings = new LinkedHashMap<>();
/**
* Creates a new instance

View File

@ -62,7 +62,7 @@ import org.springframework.util.Assert;
*/
public class HeadersConfigurer<H extends HttpSecurityBuilder<H>> extends
AbstractHttpConfigurer<HeadersConfigurer<H>, H> {
private List<HeaderWriter> headerWriters = new ArrayList<HeaderWriter>();
private List<HeaderWriter> headerWriters = new ArrayList<>();
// --- default header writers ---
@ -766,7 +766,7 @@ public class HeadersConfigurer<H extends HttpSecurityBuilder<H>> extends
* @return
*/
private List<HeaderWriter> getHeaderWriters() {
List<HeaderWriter> writers = new ArrayList<HeaderWriter>();
List<HeaderWriter> writers = new ArrayList<>();
addIfNotNull(writers, contentTypeOptions.writer);
addIfNotNull(writers, xssProtection.writer);
addIfNotNull(writers, cacheControl.writer);
@ -848,4 +848,4 @@ public class HeadersConfigurer<H extends HttpSecurityBuilder<H>> extends
}
}
}
}

View File

@ -97,7 +97,7 @@ public final class HttpBasicConfigurer<B extends HttpSecurityBuilder<B>> extends
public HttpBasicConfigurer() throws Exception {
realmName(DEFAULT_REALM);
LinkedHashMap<RequestMatcher, AuthenticationEntryPoint> entryPoints = new LinkedHashMap<RequestMatcher, AuthenticationEntryPoint>();
LinkedHashMap<RequestMatcher, AuthenticationEntryPoint> entryPoints = new LinkedHashMap<>();
entryPoints.put(X_REQUESTED_WITH, new HttpStatusEntryPoint(HttpStatus.UNAUTHORIZED));
DelegatingAuthenticationEntryPoint defaultEntryPoint = new DelegatingAuthenticationEntryPoint(

View File

@ -72,7 +72,7 @@ public final class JeeConfigurer<H extends HttpSecurityBuilder<H>> extends
AbstractHttpConfigurer<JeeConfigurer<H>, H> {
private J2eePreAuthenticatedProcessingFilter j2eePreAuthenticatedProcessingFilter;
private AuthenticationUserDetailsService<PreAuthenticatedAuthenticationToken> authenticationUserDetailsService;
private Set<String> mappableRoles = new HashSet<String>();
private Set<String> mappableRoles = new HashSet<>();
/**
* Creates a new instance

View File

@ -65,7 +65,7 @@ import org.springframework.util.Assert;
*/
public final class LogoutConfigurer<H extends HttpSecurityBuilder<H>> extends
AbstractHttpConfigurer<LogoutConfigurer<H>, H> {
private List<LogoutHandler> logoutHandlers = new ArrayList<LogoutHandler>();
private List<LogoutHandler> logoutHandlers = new ArrayList<>();
private SecurityContextLogoutHandler contextLogoutHandler = new SecurityContextLogoutHandler();
private String logoutSuccessUrl = "/login?logout";
private LogoutSuccessHandler logoutSuccessHandler;
@ -75,7 +75,7 @@ public final class LogoutConfigurer<H extends HttpSecurityBuilder<H>> extends
private boolean customLogoutSuccess;
private LinkedHashMap<RequestMatcher, LogoutSuccessHandler> defaultLogoutSuccessHandlerMappings =
new LinkedHashMap<RequestMatcher, LogoutSuccessHandler>();
new LinkedHashMap<>();
/**
* Creates a new instance

View File

@ -34,7 +34,7 @@ import org.springframework.security.web.PortMapperImpl;
public final class PortMapperConfigurer<H extends HttpSecurityBuilder<H>> extends
AbstractHttpConfigurer<PortMapperConfigurer<H>, H> {
private PortMapper portMapper;
private Map<String, String> httpsPortMappings = new HashMap<String, String>();
private Map<String, String> httpsPortMappings = new HashMap<>();
/**
* Creates a new instance

View File

@ -139,7 +139,7 @@ public final class RequestCacheConfigurer<H extends HttpSecurityBuilder<H>> exte
boolean isCsrfEnabled = http.getConfigurer(CsrfConfigurer.class) != null;
List<RequestMatcher> matchers = new ArrayList<RequestMatcher>();
List<RequestMatcher> matchers = new ArrayList<>();
if (isCsrfEnabled) {
RequestMatcher getRequests = new AntPathRequestMatcher("/**", "GET");
matchers.add(0, getRequests);

View File

@ -100,7 +100,7 @@ public final class SessionManagementConfigurer<H extends HttpSecurityBuilder<H>>
private SessionAuthenticationStrategy providedSessionAuthenticationStrategy;
private InvalidSessionStrategy invalidSessionStrategy;
private SessionInformationExpiredStrategy expiredSessionStrategy;
private List<SessionAuthenticationStrategy> sessionAuthenticationStrategies = new ArrayList<SessionAuthenticationStrategy>();
private List<SessionAuthenticationStrategy> sessionAuthenticationStrategies = new ArrayList<>();
private SessionRegistry sessionRegistry;
private Integer maximumSessions;
private String expiredUrl;

View File

@ -121,7 +121,7 @@ public final class X509Configurer<H extends HttpSecurityBuilder<H>> extends
* @return the {@link X509Configurer} for further customizations
*/
public X509Configurer<H> userDetailsService(UserDetailsService userDetailsService) {
UserDetailsByNameServiceWrapper<PreAuthenticatedAuthenticationToken> authenticationUserDetailsService = new UserDetailsByNameServiceWrapper<PreAuthenticatedAuthenticationToken>();
UserDetailsByNameServiceWrapper<PreAuthenticatedAuthenticationToken> authenticationUserDetailsService = new UserDetailsByNameServiceWrapper<>();
authenticationUserDetailsService.setUserDetailsService(userDetailsService);
return authenticationUserDetailsService(authenticationUserDetailsService);
}

View File

@ -124,7 +124,7 @@ public final class OpenIDLoginConfigurer<H extends HttpSecurityBuilder<H>> exten
private OpenIDConsumer openIDConsumer;
private ConsumerManager consumerManager;
private AuthenticationUserDetailsService<OpenIDAuthenticationToken> authenticationUserDetailsService;
private List<AttributeExchangeConfigurer> attributeExchangeConfigurers = new ArrayList<AttributeExchangeConfigurer>();
private List<AttributeExchangeConfigurer> attributeExchangeConfigurers = new ArrayList<>();
/**
* Creates a new instance
@ -341,7 +341,7 @@ public final class OpenIDLoginConfigurer<H extends HttpSecurityBuilder<H>> exten
if (this.authenticationUserDetailsService != null) {
return this.authenticationUserDetailsService;
}
return new UserDetailsByNameServiceWrapper<OpenIDAuthenticationToken>(
return new UserDetailsByNameServiceWrapper<>(
http.getSharedObject(UserDetailsService.class));
}
@ -374,8 +374,8 @@ public final class OpenIDLoginConfigurer<H extends HttpSecurityBuilder<H>> exten
*/
public final class AttributeExchangeConfigurer {
private final String identifier;
private List<OpenIDAttribute> attributes = new ArrayList<OpenIDAttribute>();
private List<AttributeConfigurer> attributeConfigurers = new ArrayList<AttributeConfigurer>();
private List<OpenIDAttribute> attributes = new ArrayList<>();
private List<AttributeConfigurer> attributeConfigurers = new ArrayList<>();
/**
* Creates a new instance

View File

@ -51,9 +51,9 @@ public class MessageSecurityMetadataSourceRegistry {
private static final String fullyAuthenticated = "fullyAuthenticated";
private static final String rememberMe = "rememberMe";
private SecurityExpressionHandler<Message<Object>> expressionHandler = new DefaultMessageSecurityExpressionHandler<Object>();
private SecurityExpressionHandler<Message<Object>> expressionHandler = new DefaultMessageSecurityExpressionHandler<>();
private final LinkedHashMap<MatcherBuilder, String> matcherToExpression = new LinkedHashMap<MatcherBuilder, String>();
private final LinkedHashMap<MatcherBuilder, String> matcherToExpression = new LinkedHashMap<>();
private DelegatingPathMatcher pathMatcher = new DelegatingPathMatcher();
@ -160,7 +160,7 @@ public class MessageSecurityMetadataSourceRegistry {
* @see {@link MessageSecurityMetadataSourceRegistry#simpDestPathMatcher(PathMatcher)}
*/
private Constraint simpDestMatchers(SimpMessageType type, String... patterns) {
List<MatcherBuilder> matchers = new ArrayList<MatcherBuilder>(patterns.length);
List<MatcherBuilder> matchers = new ArrayList<>(patterns.length);
for (String pattern : patterns) {
matchers.add(new PathMatcherMessageMatcherBuilder(pattern, type));
}
@ -201,7 +201,7 @@ public class MessageSecurityMetadataSourceRegistry {
* instances
*/
public Constraint matchers(MessageMatcher<?>... matchers) {
List<MatcherBuilder> builders = new ArrayList<MatcherBuilder>(matchers.length);
List<MatcherBuilder> builders = new ArrayList<>(matchers.length);
for (MessageMatcher<?> matcher : matchers) {
builders.add(new PreBuiltMatcherBuilder(matcher));
}

View File

@ -87,7 +87,7 @@ public abstract class AbstractSecurityWebSocketMessageBrokerConfigurer extends
AbstractWebSocketMessageBrokerConfigurer implements SmartInitializingSingleton {
private final WebSocketMessageSecurityMetadataSourceRegistry inboundRegistry = new WebSocketMessageSecurityMetadataSourceRegistry();
private SecurityExpressionHandler<Message<Object>> defaultExpressionHandler = new DefaultMessageSecurityExpressionHandler<Object>();
private SecurityExpressionHandler<Message<Object>> defaultExpressionHandler = new DefaultMessageSecurityExpressionHandler<>();
private SecurityExpressionHandler<Message<Object>> expressionHandler;
@ -156,7 +156,7 @@ public abstract class AbstractSecurityWebSocketMessageBrokerConfigurer extends
public ChannelSecurityInterceptor inboundChannelSecurity() {
ChannelSecurityInterceptor channelSecurityInterceptor = new ChannelSecurityInterceptor(
inboundMessageSecurityMetadataSource());
MessageExpressionVoter<Object> voter = new MessageExpressionVoter<Object>();
MessageExpressionVoter<Object> voter = new MessageExpressionVoter<>();
voter.setExpressionHandler(getMessageExpressionHandler());
List<AccessDecisionVoter<? extends Object>> voters = new ArrayList<AccessDecisionVoter<? extends Object>>();
@ -255,7 +255,7 @@ public abstract class AbstractSecurityWebSocketMessageBrokerConfigurer extends
TransportHandlingSockJsService transportHandlingSockJsService = (TransportHandlingSockJsService) sockJsService;
List<HandshakeInterceptor> handshakeInterceptors = transportHandlingSockJsService
.getHandshakeInterceptors();
List<HandshakeInterceptor> interceptorsToSet = new ArrayList<HandshakeInterceptor>(
List<HandshakeInterceptor> interceptorsToSet = new ArrayList<>(
handshakeInterceptors.size() + 1);
interceptorsToSet.add(new CsrfTokenHandshakeInterceptor());
interceptorsToSet.addAll(handshakeInterceptors);
@ -267,7 +267,7 @@ public abstract class AbstractSecurityWebSocketMessageBrokerConfigurer extends
WebSocketHttpRequestHandler handler = (WebSocketHttpRequestHandler) object;
List<HandshakeInterceptor> handshakeInterceptors = handler
.getHandshakeInterceptors();
List<HandshakeInterceptor> interceptorsToSet = new ArrayList<HandshakeInterceptor>(
List<HandshakeInterceptor> interceptorsToSet = new ArrayList<>(
handshakeInterceptors.size() + 1);
interceptorsToSet.add(new CsrfTokenHandshakeInterceptor());
interceptorsToSet.addAll(handshakeInterceptors);
@ -288,4 +288,4 @@ public abstract class AbstractSecurityWebSocketMessageBrokerConfigurer extends
inboundRegistry.simpDestPathMatcher(pathMatcher);
}
}
}
}

View File

@ -71,7 +71,7 @@ public class AuthenticationManagerBeanDefinitionParser implements BeanDefinition
String alias = element.getAttribute(ATT_ALIAS);
List<BeanMetadataElement> providers = new ManagedList<BeanMetadataElement>();
List<BeanMetadataElement> providers = new ManagedList<>();
NamespaceHandlerResolver resolver = pc.getReaderContext()
.getNamespaceHandlerResolver();

View File

@ -82,7 +82,7 @@ public class UserServiceBeanDefinitionParser extends
+ ATT_PROPERTIES + "' attribute)");
}
ManagedList<BeanDefinition> users = new ManagedList<BeanDefinition>();
ManagedList<BeanDefinition> users = new ManagedList<>();
for (Object elt : userElts) {
Element userElt = (Element) elt;

View File

@ -302,7 +302,7 @@ final class AuthenticationConfigBuilder {
}
private ManagedList<BeanDefinition> parseOpenIDAttributes(Element attrExElt) {
ManagedList<BeanDefinition> attributes = new ManagedList<BeanDefinition>();
ManagedList<BeanDefinition> attributes = new ManagedList<>();
for (Element attElt : DomUtils.getChildElementsByTagName(attrExElt,
Elements.OPENID_ATTRIBUTE)) {
String name = attElt.getAttribute("name");
@ -764,7 +764,7 @@ final class AuthenticationConfigBuilder {
}
List<OrderDecorator> getFilters() {
List<OrderDecorator> filters = new ArrayList<OrderDecorator>();
List<OrderDecorator> filters = new ArrayList<>();
if (anonymousFilter != null) {
filters.add(new OrderDecorator(anonymousFilter, ANONYMOUS_FILTER));
@ -810,7 +810,7 @@ final class AuthenticationConfigBuilder {
}
List<BeanReference> getProviders() {
List<BeanReference> providers = new ArrayList<BeanReference>();
List<BeanReference> providers = new ArrayList<>();
if (anonymousProviderRef != null) {
providers.add(anonymousProviderRef);

View File

@ -52,8 +52,8 @@ public class DefaultFilterChainValidator implements FilterChainProxy.FilterChain
checkFilterStack(filterChain.getFilters());
}
checkPathOrder(new ArrayList<SecurityFilterChain>(fcp.getFilterChains()));
checkForDuplicateMatchers(new ArrayList<SecurityFilterChain>(
checkPathOrder(new ArrayList<>(fcp.getFilterChains()));
checkForDuplicateMatchers(new ArrayList<>(
fcp.getFilterChains()));
}

View File

@ -57,7 +57,7 @@ public class FilterChainBeanDefinitionParser implements BeanDefinitionParser {
}
else {
String[] filterBeanNames = StringUtils.tokenizeToStringArray(filters, ",");
ManagedList<RuntimeBeanReference> filterChain = new ManagedList<RuntimeBeanReference>(
ManagedList<RuntimeBeanReference> filterChain = new ManagedList<>(
filterBeanNames.length);
for (String name : filterBeanNames) {

View File

@ -44,7 +44,7 @@ public class FilterChainMapBeanDefinitionDecorator implements BeanDefinitionDeco
ParserContext parserContext) {
BeanDefinition filterChainProxy = holder.getBeanDefinition();
ManagedList<BeanMetadataElement> securityFilterChains = new ManagedList<BeanMetadataElement>();
ManagedList<BeanMetadataElement> securityFilterChains = new ManagedList<>();
Element elt = (Element) node;
MatcherType matcherType = MatcherType.fromElement(elt);

View File

@ -155,7 +155,7 @@ public class FilterInvocationSecurityMetadataSourceParser implements BeanDefinit
MatcherType matcherType, List<Element> urlElts, boolean useExpressions,
boolean addAuthenticatedAll, ParserContext parserContext) {
ManagedMap<BeanMetadataElement, BeanDefinition> filterInvocationDefinitionMap = new ManagedMap<BeanMetadataElement, BeanDefinition>();
ManagedMap<BeanMetadataElement, BeanDefinition> filterInvocationDefinitionMap = new ManagedMap<>();
for (Element urlElt : urlElts) {
String access = urlElt.getAttribute(ATT_ACCESS);

View File

@ -91,7 +91,7 @@ public class HeadersBeanDefinitionParser implements BeanDefinitionParser {
private ManagedList<BeanMetadataElement> headerWriters;
public BeanDefinition parse(Element element, ParserContext parserContext) {
headerWriters = new ManagedList<BeanMetadataElement>();
headerWriters = new ManagedList<>();
BeanDefinitionBuilder builder = BeanDefinitionBuilder
.rootBeanDefinition(HeaderWriterFilter.class);
@ -220,7 +220,7 @@ public class HeadersBeanDefinitionParser implements BeanDefinitionParser {
if (pinsElement != null) {
List<Element> pinElements = DomUtils.getChildElements(pinsElement);
Map<String, String> pins = new LinkedHashMap<String, String>();
Map<String, String> pins = new LinkedHashMap<>();
for (Element pinElement : pinElements) {
String hash = pinElement.getAttribute(ATT_ALGORITHM);

View File

@ -370,7 +370,7 @@ class HttpConfigurationBuilder {
boolean sessionFixationProtectionRequired = !sessionFixationAttribute
.equals(OPT_SESSION_FIXATION_NO_PROTECTION);
ManagedList<BeanMetadataElement> delegateSessionStrategies = new ManagedList<BeanMetadataElement>();
ManagedList<BeanMetadataElement> delegateSessionStrategies = new ManagedList<>();
BeanDefinitionBuilder concurrentSessionStrategy;
BeanDefinitionBuilder sessionFixationStrategy = null;
BeanDefinitionBuilder registerSessionStrategy;
@ -601,7 +601,7 @@ class HttpConfigurationBuilder {
metadataSourceBldr.getBeanDefinition());
RootBeanDefinition channelDecisionManager = new RootBeanDefinition(
ChannelDecisionManagerImpl.class);
ManagedList<RootBeanDefinition> channelProcessors = new ManagedList<RootBeanDefinition>(
ManagedList<RootBeanDefinition> channelProcessors = new ManagedList<>(
3);
RootBeanDefinition secureChannelProcessor = new RootBeanDefinition(
SecureChannelProcessor.class);
@ -639,7 +639,7 @@ class HttpConfigurationBuilder {
*/
private ManagedMap<BeanMetadataElement, BeanDefinition> parseInterceptUrlsForChannelSecurity() {
ManagedMap<BeanMetadataElement, BeanDefinition> channelRequestMap = new ManagedMap<BeanMetadataElement, BeanDefinition>();
ManagedMap<BeanMetadataElement, BeanDefinition> channelRequestMap = new ManagedMap<>();
for (Element urlElt : interceptUrls) {
String path = urlElt.getAttribute(ATT_PATH_PATTERN);
@ -719,7 +719,7 @@ class HttpConfigurationBuilder {
.createSecurityMetadataSource(interceptUrls, addAllAuth, httpElt, pc);
RootBeanDefinition accessDecisionMgr;
ManagedList<BeanDefinition> voters = new ManagedList<BeanDefinition>(2);
ManagedList<BeanDefinition> voters = new ManagedList<>(2);
if (useExpressions) {
BeanDefinitionBuilder expressionVoter = BeanDefinitionBuilder
@ -820,7 +820,7 @@ class HttpConfigurationBuilder {
}
List<OrderDecorator> getFilters() {
List<OrderDecorator> filters = new ArrayList<OrderDecorator>();
List<OrderDecorator> filters = new ArrayList<>();
if (cpf != null) {
filters.add(new OrderDecorator(cpf, CHANNEL_FILTER));

View File

@ -138,7 +138,7 @@ public class HttpSecurityBeanDefinitionParser implements BeanDefinitionParser {
final BeanReference portMapper = createPortMapper(element, pc);
final BeanReference portResolver = createPortResolver(portMapper, pc);
ManagedList<BeanReference> authenticationProviders = new ManagedList<BeanReference>();
ManagedList<BeanReference> authenticationProviders = new ManagedList<>();
BeanReference authenticationManager = createAuthenticationManager(element, pc,
authenticationProviders);
@ -158,7 +158,7 @@ public class HttpSecurityBeanDefinitionParser implements BeanDefinitionParser {
authenticationProviders.addAll(authBldr.getProviders());
List<OrderDecorator> unorderedFilterChain = new ArrayList<OrderDecorator>();
List<OrderDecorator> unorderedFilterChain = new ArrayList<>();
unorderedFilterChain.addAll(httpBldr.getFilters());
unorderedFilterChain.addAll(authBldr.getFilters());
@ -168,7 +168,7 @@ public class HttpSecurityBeanDefinitionParser implements BeanDefinitionParser {
checkFilterChainOrder(unorderedFilterChain, pc, pc.extractSource(element));
// The list of filter beans
List<BeanMetadataElement> filterChain = new ManagedList<BeanMetadataElement>();
List<BeanMetadataElement> filterChain = new ManagedList<>();
for (OrderDecorator od : unorderedFilterChain) {
filterChain.add(od.bean);
@ -330,7 +330,7 @@ public class HttpSecurityBeanDefinitionParser implements BeanDefinitionParser {
List<OrderDecorator> buildCustomFilterList(Element element, ParserContext pc) {
List<Element> customFilterElts = DomUtils.getChildElementsByTagName(element,
Elements.CUSTOM_FILTER);
List<OrderDecorator> customFilters = new ArrayList<OrderDecorator>();
List<OrderDecorator> customFilters = new ArrayList<>();
final String ATT_AFTER = "after";
final String ATT_BEFORE = "before";

View File

@ -45,7 +45,7 @@ class LogoutBeanDefinitionParser implements BeanDefinitionParser {
final String rememberMeServices;
private final String defaultLogoutUrl;
private ManagedList<BeanMetadataElement> logoutHandlers = new ManagedList<BeanMetadataElement>();
private ManagedList<BeanMetadataElement> logoutHandlers = new ManagedList<>();
private boolean csrfEnabled;
public LogoutBeanDefinitionParser(String loginPageUrl, String rememberMeServices,

View File

@ -113,7 +113,7 @@ public class GlobalMethodSecurityBeanDefinitionParser implements BeanDefinitionP
Object source = pc.extractSource(element);
// The list of method metadata delegates
ManagedList<BeanMetadataElement> delegates = new ManagedList<BeanMetadataElement>();
ManagedList<BeanMetadataElement> delegates = new ManagedList<>();
boolean jsr250Enabled = "enabled".equals(element.getAttribute(ATT_USE_JSR250));
boolean useSecured = "enabled".equals(element.getAttribute(ATT_USE_SECURED));
@ -122,7 +122,7 @@ public class GlobalMethodSecurityBeanDefinitionParser implements BeanDefinitionP
boolean useAspectJ = "aspectj".equals(element.getAttribute(ATT_MODE));
BeanDefinition preInvocationVoter = null;
ManagedList<BeanMetadataElement> afterInvocationProviders = new ManagedList<BeanMetadataElement>();
ManagedList<BeanMetadataElement> afterInvocationProviders = new ManagedList<>();
// Check for an external SecurityMetadataSource, which takes priority over other
// sources
@ -399,7 +399,7 @@ public class GlobalMethodSecurityBeanDefinitionParser implements BeanDefinitionP
String[] attributeTokens = StringUtils
.commaDelimitedListToStringArray(accessConfig);
List<ConfigAttribute> attributes = new ArrayList<ConfigAttribute>(
List<ConfigAttribute> attributes = new ArrayList<>(
attributeTokens.length);
for (String token : attributeTokens) {

View File

@ -88,7 +88,7 @@ class InternalInterceptMethodsBeanDefinitionDecorator extends
// Parse the included methods
List<Element> methods = DomUtils.getChildElementsByTagName(interceptMethodsElt,
Elements.PROTECT);
Map<String, BeanDefinition> mappings = new ManagedMap<String, BeanDefinition>();
Map<String, BeanDefinition> mappings = new ManagedMap<>();
for (Element protectmethodElt : methods) {
BeanDefinitionBuilder attributeBuilder = BeanDefinitionBuilder

View File

@ -64,9 +64,9 @@ final class ProtectPointcutPostProcessor implements BeanPostProcessor {
private final Map<String, List<ConfigAttribute>> pointcutMap = new LinkedHashMap<String, List<ConfigAttribute>>();
private final MapBasedMethodSecurityMetadataSource mapBasedMethodSecurityMetadataSource;
private final Set<PointcutExpression> pointCutExpressions = new LinkedHashSet<PointcutExpression>();
private final Set<PointcutExpression> pointCutExpressions = new LinkedHashSet<>();
private final PointcutParser parser;
private final Set<String> processedBeans = new HashSet<String>();
private final Set<String> processedBeans = new HashSet<>();
public ProtectPointcutPostProcessor(
MapBasedMethodSecurityMetadataSource mapBasedMethodSecurityMetadataSource) {
@ -75,7 +75,7 @@ final class ProtectPointcutPostProcessor implements BeanPostProcessor {
this.mapBasedMethodSecurityMetadataSource = mapBasedMethodSecurityMetadataSource;
// Set up AspectJ pointcut expression parser
Set<PointcutPrimitive> supportedPrimitives = new HashSet<PointcutPrimitive>(3);
Set<PointcutPrimitive> supportedPrimitives = new HashSet<>(3);
supportedPrimitives.add(PointcutPrimitive.EXECUTION);
supportedPrimitives.add(PointcutPrimitive.ARGS);
supportedPrimitives.add(PointcutPrimitive.REFERENCE);

View File

@ -116,7 +116,7 @@ public final class WebSocketMessageBrokerSecurityBeanDefinitionParser implements
BeanDefinitionRegistry registry = parserContext.getRegistry();
XmlReaderContext context = parserContext.getReaderContext();
ManagedMap<BeanDefinition, String> matcherToExpression = new ManagedMap<BeanDefinition, String>();
ManagedMap<BeanDefinition, String> matcherToExpression = new ManagedMap<>();
String id = element.getAttribute(ID_ATTR);
Element expressionHandlerElt = DomUtils.getChildElementByTagName(element,
@ -149,7 +149,7 @@ public final class WebSocketMessageBrokerSecurityBeanDefinitionParser implements
String mdsId = context.registerWithGeneratedName(mds.getBeanDefinition());
ManagedList<BeanDefinition> voters = new ManagedList<BeanDefinition>();
ManagedList<BeanDefinition> voters = new ManagedList<>();
BeanDefinitionBuilder messageExpressionVoterBldr = BeanDefinitionBuilder.rootBeanDefinition(MessageExpressionVoter.class);
if(expressionHandlerDefined) {
messageExpressionVoterBldr.addPropertyReference("expressionHandler", expressionHandlerRef);
@ -259,7 +259,7 @@ public final class WebSocketMessageBrokerSecurityBeanDefinitionParser implements
WEB_SOCKET_AMMH_CLASS_NAME.equals(beanClassName)) {
PropertyValue current = bd.getPropertyValues().getPropertyValue(
CUSTOM_ARG_RESOLVERS_PROP);
ManagedList<Object> argResolvers = new ManagedList<Object>();
ManagedList<Object> argResolvers = new ManagedList<>();
if (current != null) {
argResolvers.addAll((ManagedList<?>) current.getValue());
}
@ -322,7 +322,7 @@ public final class WebSocketMessageBrokerSecurityBeanDefinitionParser implements
return;
}
String interceptorPropertyName = "handshakeInterceptors";
ManagedList<? super Object> interceptors = new ManagedList<Object>();
ManagedList<? super Object> interceptors = new ManagedList<>();
interceptors.add(new RootBeanDefinition(CsrfTokenHandshakeInterceptor.class));
interceptors.addAll((ManagedList<Object>) bd.getPropertyValues().get(
interceptorPropertyName));
@ -371,4 +371,4 @@ public final class WebSocketMessageBrokerSecurityBeanDefinitionParser implements
this.delegate = pathMatcher;
}
}
}
}

View File

@ -31,7 +31,7 @@ public class ObjectPostProcessorTests {
@Test
public void convertTypes() {
assertThat((Object) PerformConversion.perform(new ArrayList<Object>()))
assertThat((Object) PerformConversion.perform(new ArrayList<>()))
.isInstanceOf(LinkedList.class);
}
}

View File

@ -25,7 +25,7 @@ public class DisableUseExpressionsConfig extends BaseWebConfig {
protected void configure(HttpSecurity http) throws Exception {
// This config is also on UrlAuthorizationConfigurer javadoc
http
.apply(new UrlAuthorizationConfigurer<HttpSecurity>(getApplicationContext())).getRegistry()
.apply(new UrlAuthorizationConfigurer<>(getApplicationContext())).getRegistry()
.antMatchers("/users**", "/sessions/**").hasRole("USER")
.antMatchers("/signup").hasRole("ANONYMOUS")
.anyRequest().hasRole("USER");

View File

@ -24,8 +24,8 @@ import java.util.*;
* @author Luke Taylor
*/
public class BeanNameCollectingPostProcessor implements BeanPostProcessor {
Set<String> beforeInitPostProcessedBeans = new HashSet<String>();
Set<String> afterInitPostProcessedBeans = new HashSet<String>();
Set<String> beforeInitPostProcessedBeans = new HashSet<>();
Set<String> afterInitPostProcessedBeans = new HashSet<>();
public Object postProcessBeforeInitialization(Object bean, String beanName)
throws BeansException {

View File

@ -30,10 +30,10 @@ import org.springframework.security.authentication.event.AbstractAuthenticationF
* @since 3.1
*/
public class CollectingAppListener implements ApplicationListener {
Set<ApplicationEvent> events = new HashSet<ApplicationEvent>();
Set<AbstractAuthenticationEvent> authenticationEvents = new HashSet<AbstractAuthenticationEvent>();
Set<AbstractAuthenticationFailureEvent> authenticationFailureEvents = new HashSet<AbstractAuthenticationFailureEvent>();
Set<AbstractAuthorizationEvent> authorizationEvents = new HashSet<AbstractAuthorizationEvent>();
Set<ApplicationEvent> events = new HashSet<>();
Set<AbstractAuthenticationEvent> authenticationEvents = new HashSet<>();
Set<AbstractAuthenticationFailureEvent> authenticationFailureEvents = new HashSet<>();
Set<AbstractAuthorizationEvent> authorizationEvents = new HashSet<>();
public void onApplicationEvent(ApplicationEvent event) {
if (event instanceof AbstractAuthenticationEvent) {

View File

@ -24,7 +24,7 @@ import java.util.List;
*/
class ConcereteSecurityConfigurerAdapter extends
SecurityConfigurerAdapter<Object, SecurityBuilder<Object>> {
private List<Object> list = new ArrayList<Object>();
private List<Object> list = new ArrayList<>();
@Override
public void configure(SecurityBuilder<Object> builder) throws Exception {

View File

@ -30,7 +30,7 @@ public class LdapAuthenticationProviderConfigurerTest {
@Before
public void setUp() {
configurer = new LdapAuthenticationProviderConfigurer<AuthenticationManagerBuilder>();
configurer = new LdapAuthenticationProviderConfigurer<>();
}
// SEC-2557

View File

@ -107,14 +107,14 @@ public class AbstractSecurityWebSocketMessageBrokerConfigurerDocTests {
private Message<String> message(SimpMessageHeaderAccessor headers, String destination) {
headers.setSessionId("123");
headers.setSessionAttributes(new HashMap<String, Object>());
headers.setSessionAttributes(new HashMap<>());
if (destination != null) {
headers.setDestination(destination);
}
if (messageUser != null) {
headers.setUser(messageUser);
}
return new GenericMessage<String>("hi", headers.getMessageHeaders());
return new GenericMessage<>("hi", headers.getMessageHeaders());
}
@Controller

View File

@ -511,14 +511,14 @@ public class AbstractSecurityWebSocketMessageBrokerConfigurerTests {
private Message<String> message(SimpMessageHeaderAccessor headers, String destination) {
headers.setSessionId("123");
headers.setSessionAttributes(new HashMap<String, Object>());
headers.setSessionAttributes(new HashMap<>());
if (destination != null) {
headers.setDestination(destination);
}
if (messageUser != null) {
headers.setUser(messageUser);
}
return new GenericMessage<String>("hi", headers.getMessageHeaders());
return new GenericMessage<>("hi", headers.getMessageHeaders());
}
private MessageChannel clientInboundChannel() {

View File

@ -114,7 +114,7 @@ public class AuthenticationManagerBeanDefinitionParserTests {
private static class AuthListener implements
ApplicationListener<AbstractAuthenticationEvent> {
List<AbstractAuthenticationEvent> events = new ArrayList<AbstractAuthenticationEvent>();
List<AbstractAuthenticationEvent> events = new ArrayList<>();
public void onApplicationEvent(AbstractAuthenticationEvent event) {
this.events.add(event);

View File

@ -287,7 +287,7 @@ public class GlobalMethodSecurityBeanDefinitionParserTests {
+ AUTH_PROVIDER_XML);
SecurityContextHolder.getContext().setAuthentication(bob);
target = (BusinessService) appContext.getBean("target");
List<String> arg = new ArrayList<String>();
List<String> arg = new ArrayList<>();
arg.add("joe");
arg.add("bob");
arg.add("sam");

View File

@ -76,7 +76,7 @@ public class SecurityConfig implements ConfigAttribute {
public static List<ConfigAttribute> createList(String... attributeNames) {
Assert.notNull(attributeNames, "You must supply an array of attribute names");
List<ConfigAttribute> attributes = new ArrayList<ConfigAttribute>(
List<ConfigAttribute> attributes = new ArrayList<>(
attributeNames.length);
for (String attribute : attributeNames) {

View File

@ -75,7 +75,7 @@ public class Jsr250MethodSecurityMetadataSource extends
if (annotations == null || annotations.length == 0) {
return null;
}
List<ConfigAttribute> attributes = new ArrayList<ConfigAttribute>();
List<ConfigAttribute> attributes = new ArrayList<>();
for (Annotation a : annotations) {
if (a instanceof DenyAll) {

View File

@ -84,7 +84,7 @@ class SecuredAnnotationMetadataExtractor implements AnnotationMetadataExtractor<
public Collection<ConfigAttribute> extractAttributes(Secured secured) {
String[] attributeTokens = secured.value();
List<ConfigAttribute> attributes = new ArrayList<ConfigAttribute>(
List<ConfigAttribute> attributes = new ArrayList<>(
attributeTokens.length);
for (String token : attributeTokens) {

View File

@ -158,7 +158,7 @@ public abstract class SecurityExpressionRoot implements SecurityExpressionOperat
private Set<String> getAuthoritySet() {
if (roles == null) {
roles = new HashSet<String>();
roles = new HashSet<>();
Collection<? extends GrantedAuthority> userAuthorities = authentication
.getAuthorities();

View File

@ -115,7 +115,7 @@ public class RoleHierarchyImpl implements RoleHierarchy {
return AuthorityUtils.NO_AUTHORITIES;
}
Set<GrantedAuthority> reachableRoles = new HashSet<GrantedAuthority>();
Set<GrantedAuthority> reachableRoles = new HashSet<>();
for (GrantedAuthority authority : authorities) {
addReachableRoles(reachableRoles, authority);
@ -132,7 +132,7 @@ public class RoleHierarchyImpl implements RoleHierarchy {
+ " in zero or more steps.");
}
List<GrantedAuthority> reachableRoleList = new ArrayList<GrantedAuthority>(
List<GrantedAuthority> reachableRoleList = new ArrayList<>(
reachableRoles.size());
reachableRoleList.addAll(reachableRoles);
@ -190,7 +190,7 @@ public class RoleHierarchyImpl implements RoleHierarchy {
Set<GrantedAuthority> rolesReachableInOneStepSet;
if (!this.rolesReachableInOneStepMap.containsKey(higherRole)) {
rolesReachableInOneStepSet = new HashSet<GrantedAuthority>();
rolesReachableInOneStepSet = new HashSet<>();
this.rolesReachableInOneStepMap.put(higherRole,
rolesReachableInOneStepSet);
}
@ -212,17 +212,17 @@ public class RoleHierarchyImpl implements RoleHierarchy {
* detected)
*/
private void buildRolesReachableInOneOrMoreStepsMap() {
this.rolesReachableInOneOrMoreStepsMap = new HashMap<GrantedAuthority, Set<GrantedAuthority>>();
this.rolesReachableInOneOrMoreStepsMap = new HashMap<>();
// iterate over all higher roles from rolesReachableInOneStepMap
for (GrantedAuthority role : this.rolesReachableInOneStepMap.keySet()) {
Set<GrantedAuthority> rolesToVisitSet = new HashSet<GrantedAuthority>();
Set<GrantedAuthority> rolesToVisitSet = new HashSet<>();
if (this.rolesReachableInOneStepMap.containsKey(role)) {
rolesToVisitSet.addAll(this.rolesReachableInOneStepMap.get(role));
}
Set<GrantedAuthority> visitedRolesSet = new HashSet<GrantedAuthority>();
Set<GrantedAuthority> visitedRolesSet = new HashSet<>();
while (!rolesToVisitSet.isEmpty()) {
// take a role from the rolesToVisit set

View File

@ -161,7 +161,7 @@ public abstract class AbstractSecurityInterceptor implements InitializingBean,
return;
}
Set<ConfigAttribute> unsupportedAttrs = new HashSet<ConfigAttribute>();
Set<ConfigAttribute> unsupportedAttrs = new HashSet<>();
for (ConfigAttribute attr : attributeDefs) {
if (!this.runAsManager.supports(attr)

View File

@ -91,7 +91,7 @@ public class AfterInvocationProviderManager implements AfterInvocationManager,
public void setProviders(List<?> newList) {
checkIfValidList(newList);
providers = new ArrayList<AfterInvocationProvider>(newList.size());
providers = new ArrayList<>(newList.size());
for (Object currentObject : newList) {
Assert.isInstanceOf(AfterInvocationProvider.class, currentObject,

View File

@ -71,7 +71,7 @@ public class RunAsManagerImpl implements RunAsManager, InitializingBean {
public Authentication buildRunAs(Authentication authentication, Object object,
Collection<ConfigAttribute> attributes) {
List<GrantedAuthority> newAuthorities = new ArrayList<GrantedAuthority>();
List<GrantedAuthority> newAuthorities = new ArrayList<>();
for (ConfigAttribute attribute : attributes) {
if (this.supports(attribute)) {

View File

@ -95,7 +95,7 @@ public final class DelegatingMethodSecurityMetadataSource extends
@Override
public Collection<ConfigAttribute> getAllConfigAttributes() {
Set<ConfigAttribute> set = new HashSet<ConfigAttribute>();
Set<ConfigAttribute> set = new HashSet<>();
for (MethodSecurityMetadataSource s : methodSecurityMetadataSources) {
Collection<ConfigAttribute> attrs = s.getAllConfigAttributes();
if (attrs != null) {

View File

@ -50,10 +50,10 @@ public class MapBasedMethodSecurityMetadataSource extends
private ClassLoader beanClassLoader = ClassUtils.getDefaultClassLoader();
/** Map from RegisteredMethod to ConfigAttribute list */
protected final Map<RegisteredMethod, List<ConfigAttribute>> methodMap = new HashMap<RegisteredMethod, List<ConfigAttribute>>();
protected final Map<RegisteredMethod, List<ConfigAttribute>> methodMap = new HashMap<>();
/** Map from RegisteredMethod to name pattern used for registration */
private final Map<RegisteredMethod, String> nameMap = new HashMap<RegisteredMethod, String>();
private final Map<RegisteredMethod, String> nameMap = new HashMap<>();
// ~ Methods
// ========================================================================================================
@ -150,7 +150,7 @@ public class MapBasedMethodSecurityMetadataSource extends
}
Method[] methods = javaType.getMethods();
List<Method> matchingMethods = new ArrayList<Method>();
List<Method> matchingMethods = new ArrayList<>();
for (Method m : methods) {
if (m.getName().equals(mappedName) || isMatch(m.getName(), mappedName)) {
@ -236,7 +236,7 @@ public class MapBasedMethodSecurityMetadataSource extends
*/
@Override
public Collection<ConfigAttribute> getAllConfigAttributes() {
Set<ConfigAttribute> allAttributes = new HashSet<ConfigAttribute>();
Set<ConfigAttribute> allAttributes = new HashSet<>();
for (List<ConfigAttribute> attributeList : methodMap.values()) {
allAttributes.addAll(attributeList);

View File

@ -84,7 +84,7 @@ public class PrePostAnnotationSecurityMetadataSource extends
String postAuthorizeAttribute = postAuthorize == null ? null : postAuthorize
.value();
ArrayList<ConfigAttribute> attrs = new ArrayList<ConfigAttribute>(2);
ArrayList<ConfigAttribute> attrs = new ArrayList<>(2);
PreInvocationAttribute pre = attributeFactory.createPreInvocationAttribute(
preFilterAttribute, filterObject, preAuthorizeAttribute);

View File

@ -66,7 +66,7 @@ public class UnanimousBased extends AbstractAccessDecisionManager {
int grant = 0;
int abstain = 0;
List<ConfigAttribute> singleAttributeList = new ArrayList<ConfigAttribute>(1);
List<ConfigAttribute> singleAttributeList = new ArrayList<>(1);
singleAttributeList.add(null);
for (ConfigAttribute attribute : attributes) {

View File

@ -66,7 +66,7 @@ public abstract class AbstractAuthenticationToken implements Authentication,
"Authorities collection cannot contain any null elements");
}
}
ArrayList<GrantedAuthority> temp = new ArrayList<GrantedAuthority>(
ArrayList<GrantedAuthority> temp = new ArrayList<>(
authorities.size());
temp.addAll(authorities);
this.authorities = Collections.unmodifiableList(temp);

View File

@ -181,7 +181,7 @@ public abstract class AbstractJaasAuthenticationProvider
// Create a set to hold the authorities, and add any that have already been
// applied.
authorities = new HashSet<GrantedAuthority>();
authorities = new HashSet<>();
// Get the subject principals and pass them to each of the AuthorityGranters
Set<Principal> principals = loginContext.getSubject().getPrincipals();
@ -203,7 +203,7 @@ public abstract class AbstractJaasAuthenticationProvider
// Convert the authorities set back to an array and apply it to the token.
JaasAuthenticationToken result = new JaasAuthenticationToken(
request.getPrincipal(), request.getCredentials(),
new ArrayList<GrantedAuthority>(authorities), loginContext);
new ArrayList<>(authorities), loginContext);
// Publish the success event
publishSuccessEvent(result);

View File

@ -116,8 +116,8 @@ public final class DelegatingSecurityContextCallable<V> implements Callable<V> {
*/
public static <V> Callable<V> create(Callable<V> delegate,
SecurityContext securityContext) {
return securityContext == null ? new DelegatingSecurityContextCallable<V>(
delegate) : new DelegatingSecurityContextCallable<V>(delegate,
return securityContext == null ? new DelegatingSecurityContextCallable<>(
delegate) : new DelegatingSecurityContextCallable<>(delegate,
securityContext);
}
}

View File

@ -354,7 +354,7 @@ class ComparableVersion implements Comparable<ComparableVersion> {
ListItem list = items;
Stack<Item> stack = new Stack<Item>();
Stack<Item> stack = new Stack<>();
stack.push(list);
boolean isDigit = false;

View File

@ -55,7 +55,7 @@ public abstract class AuthorityUtils {
*/
public static Set<String> authorityListToSet(
Collection<? extends GrantedAuthority> userAuthorities) {
Set<String> set = new HashSet<String>(userAuthorities.size());
Set<String> set = new HashSet<>(userAuthorities.size());
for (GrantedAuthority authority : userAuthorities) {
set.add(authority.getAuthority());
@ -65,7 +65,7 @@ public abstract class AuthorityUtils {
}
public static List<GrantedAuthority> createAuthorityList(String... roles) {
List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>(roles.length);
List<GrantedAuthority> authorities = new ArrayList<>(roles.length);
for (String role : roles) {
authorities.add(new SimpleGrantedAuthority(role));

View File

@ -47,7 +47,7 @@ public class MapBasedAttributes2GrantedAuthoritiesMapper implements
* Map the given array of attributes to Spring Security GrantedAuthorities.
*/
public List<GrantedAuthority> getGrantedAuthorities(Collection<String> attributes) {
ArrayList<GrantedAuthority> gaList = new ArrayList<GrantedAuthority>();
ArrayList<GrantedAuthority> gaList = new ArrayList<>();
for (String attribute : attributes) {
Collection<GrantedAuthority> c = attributes2grantedAuthoritiesMap
.get(attribute);
@ -107,7 +107,7 @@ public class MapBasedAttributes2GrantedAuthoritiesMapper implements
* @return Collection containing the GrantedAuthority Collection
*/
private Collection<GrantedAuthority> getGrantedAuthorityCollection(Object value) {
Collection<GrantedAuthority> result = new ArrayList<GrantedAuthority>();
Collection<GrantedAuthority> result = new ArrayList<>();
addGrantedAuthorityCollection(result, value);
return result;
}

View File

@ -62,7 +62,7 @@ public class SimpleAttributes2GrantedAuthoritiesMapper implements
* GrantedAuthorities.
*/
public List<GrantedAuthority> getGrantedAuthorities(Collection<String> attributes) {
List<GrantedAuthority> result = new ArrayList<GrantedAuthority>(attributes.size());
List<GrantedAuthority> result = new ArrayList<>(attributes.size());
for (String attribute : attributes) {
result.add(getGrantedAuthority(attribute));
}

View File

@ -54,7 +54,7 @@ public final class SimpleAuthorityMapper implements GrantedAuthoritiesMapper,
*/
public Set<GrantedAuthority> mapAuthorities(
Collection<? extends GrantedAuthority> authorities) {
HashSet<GrantedAuthority> mapped = new HashSet<GrantedAuthority>(
HashSet<GrantedAuthority> mapped = new HashSet<>(
authorities.size());
for (GrantedAuthority authority : authorities) {
mapped.add(mapAuthority(authority.getAuthority()));

View File

@ -41,7 +41,7 @@ public class SimpleMappableAttributesRetriever implements MappableAttributesRetr
}
public void setMappableAttributes(Set<String> aMappableRoles) {
this.mappableAttributes = new HashSet<String>();
this.mappableAttributes = new HashSet<>();
this.mappableAttributes.addAll(aMappableRoles);
this.mappableAttributes = Collections.unmodifiableSet(this.mappableAttributes);
}

View File

@ -31,7 +31,7 @@ final class InheritableThreadLocalSecurityContextHolderStrategy implements
// ~ Static fields/initializers
// =====================================================================================
private static final ThreadLocal<SecurityContext> contextHolder = new InheritableThreadLocal<SecurityContext>();
private static final ThreadLocal<SecurityContext> contextHolder = new InheritableThreadLocal<>();
// ~ Methods
// ========================================================================================================

View File

@ -32,7 +32,7 @@ final class ThreadLocalSecurityContextHolderStrategy implements
// ~ Static fields/initializers
// =====================================================================================
private static final ThreadLocal<SecurityContext> contextHolder = new ThreadLocal<SecurityContext>();
private static final ThreadLocal<SecurityContext> contextHolder = new ThreadLocal<>();
// ~ Methods
// ========================================================================================================

View File

@ -91,7 +91,7 @@ public class AnnotationParameterNameDiscoverer implements ParameterNameDiscovere
private final Set<String> annotationClassesToUse;
public AnnotationParameterNameDiscoverer(String... annotationClassToUse) {
this(new HashSet<String>(Arrays.asList(annotationClassToUse)));
this(new HashSet<>(Arrays.asList(annotationClassToUse)));
}
public AnnotationParameterNameDiscoverer(Set<String> annotationClassesToUse) {
@ -210,4 +210,4 @@ public class AnnotationParameterNameDiscoverer implements ParameterNameDiscovere
*/
Annotation[][] findParameterAnnotations(T t);
}
}
}

View File

@ -81,7 +81,7 @@ public class DefaultSecurityParameterNameDiscoverer extends
addDiscoverer(discover);
}
Set<String> annotationClassesToUse = new HashSet<String>(2);
Set<String> annotationClassesToUse = new HashSet<>(2);
annotationClassesToUse.add("org.springframework.security.access.method.P");
annotationClassesToUse.add(P.class.getName());
if (DATA_PARAM_PRESENT) {
@ -91,4 +91,4 @@ public class DefaultSecurityParameterNameDiscoverer extends
addDiscoverer(new AnnotationParameterNameDiscoverer(annotationClassesToUse));
addDiscoverer(new DefaultParameterNameDiscoverer());
}
}
}

View File

@ -56,8 +56,8 @@ public class SessionRegistryImpl implements SessionRegistry,
// ========================================================================================================
public SessionRegistryImpl() {
this.principals = new ConcurrentHashMap<Object, Set<String>>();
this.sessionIds = new ConcurrentHashMap<String, SessionInformation>();
this.principals = new ConcurrentHashMap<>();
this.sessionIds = new ConcurrentHashMap<>();
}
public SessionRegistryImpl(ConcurrentMap<Object, Set<String>> principals, Map<String, SessionInformation> sessionIds) {
@ -66,7 +66,7 @@ public class SessionRegistryImpl implements SessionRegistry,
}
public List<Object> getAllPrincipals() {
return new ArrayList<Object>(principals.keySet());
return new ArrayList<>(principals.keySet());
}
public List<SessionInformation> getAllSessions(Object principal,
@ -77,7 +77,7 @@ public class SessionRegistryImpl implements SessionRegistry,
return Collections.emptyList();
}
List<SessionInformation> list = new ArrayList<SessionInformation>(
List<SessionInformation> list = new ArrayList<>(
sessionsUsedByPrincipal.size());
for (String sessionId : sessionsUsedByPrincipal) {
@ -135,7 +135,7 @@ public class SessionRegistryImpl implements SessionRegistry,
Set<String> sessionsUsedByPrincipal = principals.get(principal);
if (sessionsUsedByPrincipal == null) {
sessionsUsedByPrincipal = new CopyOnWriteArraySet<String>();
sessionsUsedByPrincipal = new CopyOnWriteArraySet<>();
Set<String> prevSessionsUsedByPrincipal = principals.putIfAbsent(principal,
sessionsUsedByPrincipal);
if (prevSessionsUsedByPrincipal != null) {

View File

@ -159,7 +159,7 @@ public class User implements UserDetails, CredentialsContainer {
Assert.notNull(authorities, "Cannot pass a null GrantedAuthority collection");
// Ensure array iteration order is predictable (as per
// UserDetails.getAuthorities() contract and SEC-717)
SortedSet<GrantedAuthority> sortedAuthorities = new TreeSet<GrantedAuthority>(
SortedSet<GrantedAuthority> sortedAuthorities = new TreeSet<>(
new AuthorityComparator());
for (GrantedAuthority grantedAuthority : authorities) {
@ -367,7 +367,7 @@ public class User implements UserDetails, CredentialsContainer {
* additional attributes for this user)
*/
public UserBuilder roles(String... roles) {
List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>(
List<GrantedAuthority> authorities = new ArrayList<>(
roles.length);
for (String role : roles) {
Assert.isTrue(!role.startsWith("ROLE_"), role
@ -400,7 +400,7 @@ public class User implements UserDetails, CredentialsContainer {
* @see #roles(String...)
*/
public UserBuilder authorities(Collection<? extends GrantedAuthority> authorities) {
this.authorities = new ArrayList<GrantedAuthority>(authorities);
this.authorities = new ArrayList<>(authorities);
return this;
}

View File

@ -193,7 +193,7 @@ public class JdbcDaoImpl extends JdbcDaoSupport
UserDetails user = users.get(0); // contains no GrantedAuthority[]
Set<GrantedAuthority> dbAuthsSet = new HashSet<GrantedAuthority>();
Set<GrantedAuthority> dbAuthsSet = new HashSet<>();
if (this.enableAuthorities) {
dbAuthsSet.addAll(loadUserAuthorities(user.getUsername()));
@ -203,7 +203,7 @@ public class JdbcDaoImpl extends JdbcDaoSupport
dbAuthsSet.addAll(loadGroupAuthorities(user.getUsername()));
}
List<GrantedAuthority> dbAuths = new ArrayList<GrantedAuthority>(dbAuthsSet);
List<GrantedAuthority> dbAuths = new ArrayList<>(dbAuthsSet);
addCustomAuthorities(user.getUsername(), dbAuths);

View File

@ -33,7 +33,7 @@ public class UserAttribute {
// ~ Instance fields
// ================================================================================================
private List<GrantedAuthority> authorities = new Vector<GrantedAuthority>();
private List<GrantedAuthority> authorities = new Vector<>();
private String password;
private boolean enabled = true;
@ -66,7 +66,7 @@ public class UserAttribute {
* @since 1.1
*/
public void setAuthoritiesAsString(List<String> authoritiesAsStrings) {
setAuthorities(new ArrayList<GrantedAuthority>(authoritiesAsStrings.size()));
setAuthorities(new ArrayList<>(authoritiesAsStrings.size()));
for (String authority : authoritiesAsStrings) {
addAuthority(new SimpleGrantedAuthority(authority));
}

View File

@ -37,7 +37,7 @@ public class UserAttributeEditor extends PropertyEditorSupport {
String[] tokens = StringUtils.commaDelimitedListToStringArray(s);
UserAttribute userAttrib = new UserAttribute();
List<String> authoritiesAsStrings = new ArrayList<String>();
List<String> authoritiesAsStrings = new ArrayList<>();
for (int i = 0; i < tokens.length; i++) {
String currentToken = tokens[i].trim();

View File

@ -95,7 +95,7 @@ public final class SecurityJackson2Modules {
* @return List of available security modules in classpath.
*/
public static List<Module> getModules(ClassLoader loader) {
List<Module> modules = new ArrayList<Module>();
List<Module> modules = new ArrayList<>();
for (String className : securityJackson2ModuleClasses) {
Module module = loadAndGetInstance(className, loader);
if (module != null) {

View File

@ -43,7 +43,7 @@ class UnmodifiableSetDeserializer extends JsonDeserializer<Set> {
public Set deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
ObjectMapper mapper = (ObjectMapper) jp.getCodec();
JsonNode node = mapper.readTree(jp);
Set<Object> resultSet = new HashSet<Object>();
Set<Object> resultSet = new HashSet<>();
if (node != null) {
if (node instanceof ArrayNode) {
ArrayNode arrayNode = (ArrayNode) node;

Some files were not shown because too many files have changed in this diff Show More