Type parameter extends Object

Reports any type parameters and wildcard type arguments explicitly declared to extend java.lang.Object.
This commit is contained in:
Lars Grefer 2019-08-09 00:40:13 +02:00
parent fe9e454978
commit eddcd1622f
16 changed files with 27 additions and 27 deletions

View File

@ -58,7 +58,7 @@ public abstract class AbstractConfiguredSecurityBuilder<O, B extends SecurityBui
private final LinkedHashMap<Class<? extends SecurityConfigurer<O, B>>, List<SecurityConfigurer<O, B>>> configurers = new LinkedHashMap<>(); private final LinkedHashMap<Class<? extends SecurityConfigurer<O, B>>, List<SecurityConfigurer<O, B>>> configurers = new LinkedHashMap<>();
private final List<SecurityConfigurer<O, B>> configurersAddedInInitializing = new ArrayList<>(); private final List<SecurityConfigurer<O, B>> configurersAddedInInitializing = new ArrayList<>();
private final Map<Class<? extends Object>, Object> sharedObjects = new HashMap<>(); private final Map<Class<?>, Object> sharedObjects = new HashMap<>();
private final boolean allowConfigurersOfSameType; private final boolean allowConfigurersOfSameType;
@ -174,7 +174,7 @@ public abstract class AbstractConfiguredSecurityBuilder<O, B extends SecurityBui
* Gets the shared objects * Gets the shared objects
* @return the shared Objects * @return the shared Objects
*/ */
public Map<Class<? extends Object>, Object> getSharedObjects() { public Map<Class<?>, Object> getSharedObjects() {
return Collections.unmodifiableMap(this.sharedObjects); return Collections.unmodifiableMap(this.sharedObjects);
} }

View File

@ -111,7 +111,7 @@ public abstract class SecurityConfigurerAdapter<O, B extends SecurityBuilder<O>>
*/ */
private static final class CompositeObjectPostProcessor implements private static final class CompositeObjectPostProcessor implements
ObjectPostProcessor<Object> { ObjectPostProcessor<Object> {
private List<ObjectPostProcessor<? extends Object>> postProcessors = new ArrayList<>(); private List<ObjectPostProcessor<?>> postProcessors = new ArrayList<>();
@SuppressWarnings({ "rawtypes", "unchecked" }) @SuppressWarnings({ "rawtypes", "unchecked" })
public Object postProcess(Object object) { public Object postProcess(Object object) {
@ -132,7 +132,7 @@ public abstract class SecurityConfigurerAdapter<O, B extends SecurityBuilder<O>>
* @return true if the {@link ObjectPostProcessor} was added, else false * @return true if the {@link ObjectPostProcessor} was added, else false
*/ */
private boolean addObjectPostProcessor( private boolean addObjectPostProcessor(
ObjectPostProcessor<? extends Object> objectPostProcessor) { ObjectPostProcessor<?> objectPostProcessor) {
boolean result = this.postProcessors.add(objectPostProcessor); boolean result = this.postProcessors.add(objectPostProcessor);
Collections.sort(postProcessors, AnnotationAwareOrderComparator.INSTANCE); Collections.sort(postProcessors, AnnotationAwareOrderComparator.INSTANCE);
return result; return result;

View File

@ -241,7 +241,7 @@ public class GlobalMethodSecurityConfiguration
* @return the {@link AccessDecisionManager} to use * @return the {@link AccessDecisionManager} to use
*/ */
protected AccessDecisionManager accessDecisionManager() { protected AccessDecisionManager accessDecisionManager() {
List<AccessDecisionVoter<? extends Object>> decisionVoters = new ArrayList<>(); List<AccessDecisionVoter<?>> decisionVoters = new ArrayList<>();
ExpressionBasedPreInvocationAdvice expressionAdvice = new ExpressionBasedPreInvocationAdvice(); ExpressionBasedPreInvocationAdvice expressionAdvice = new ExpressionBasedPreInvocationAdvice();
expressionAdvice.setExpressionHandler(getExpressionHandler()); expressionAdvice.setExpressionHandler(getExpressionHandler());
if (prePostEnabled()) { if (prePostEnabled()) {

View File

@ -138,11 +138,11 @@ public final class HttpSecurity extends
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public HttpSecurity(ObjectPostProcessor<Object> objectPostProcessor, public HttpSecurity(ObjectPostProcessor<Object> objectPostProcessor,
AuthenticationManagerBuilder authenticationBuilder, AuthenticationManagerBuilder authenticationBuilder,
Map<Class<? extends Object>, Object> sharedObjects) { Map<Class<?>, Object> sharedObjects) {
super(objectPostProcessor); super(objectPostProcessor);
Assert.notNull(authenticationBuilder, "authenticationBuilder cannot be null"); Assert.notNull(authenticationBuilder, "authenticationBuilder cannot be null");
setSharedObject(AuthenticationManagerBuilder.class, authenticationBuilder); setSharedObject(AuthenticationManagerBuilder.class, authenticationBuilder);
for (Map.Entry<Class<? extends Object>, Object> entry : sharedObjects for (Map.Entry<Class<?>, Object> entry : sharedObjects
.entrySet()) { .entrySet()) {
setSharedObject((Class<Object>) entry.getKey(), entry.getValue()); setSharedObject((Class<Object>) entry.getKey(), entry.getValue());
} }

View File

@ -201,7 +201,7 @@ public abstract class WebSecurityConfigurerAdapter implements
AuthenticationManager authenticationManager = authenticationManager(); AuthenticationManager authenticationManager = authenticationManager();
authenticationBuilder.parentAuthenticationManager(authenticationManager); authenticationBuilder.parentAuthenticationManager(authenticationManager);
authenticationBuilder.authenticationEventPublisher(eventPublisher); authenticationBuilder.authenticationEventPublisher(eventPublisher);
Map<Class<? extends Object>, Object> sharedObjects = createSharedObjects(); Map<Class<?>, Object> sharedObjects = createSharedObjects();
http = new HttpSecurity(objectPostProcessor, authenticationBuilder, http = new HttpSecurity(objectPostProcessor, authenticationBuilder,
sharedObjects); sharedObjects);
@ -412,8 +412,8 @@ public abstract class WebSecurityConfigurerAdapter implements
* *
* @return the shared Objects * @return the shared Objects
*/ */
private Map<Class<? extends Object>, Object> createSharedObjects() { private Map<Class<?>, Object> createSharedObjects() {
Map<Class<? extends Object>, Object> sharedObjects = new HashMap<>(); Map<Class<?>, Object> sharedObjects = new HashMap<>();
sharedObjects.putAll(localConfigureAuthenticationBldr.getSharedObjects()); sharedObjects.putAll(localConfigureAuthenticationBldr.getSharedObjects());
sharedObjects.put(UserDetailsService.class, userDetailsService()); sharedObjects.put(UserDetailsService.class, userDetailsService());
sharedObjects.put(ApplicationContext.class, context); sharedObjects.put(ApplicationContext.class, context);

View File

@ -108,7 +108,7 @@ abstract class AbstractInterceptUrlConfigurer<C extends AbstractInterceptUrlConf
* @return the {@link AccessDecisionVoter} instances used to create the default * @return the {@link AccessDecisionVoter} instances used to create the default
* {@link AccessDecisionManager} * {@link AccessDecisionManager}
*/ */
abstract List<AccessDecisionVoter<? extends Object>> getDecisionVoters(H http); abstract List<AccessDecisionVoter<?>> getDecisionVoters(H http);
abstract class AbstractInterceptUrlRegistry<R extends AbstractInterceptUrlRegistry<R, T>, T> abstract class AbstractInterceptUrlRegistry<R extends AbstractInterceptUrlRegistry<R, T>, T>
extends AbstractConfigAttributeRequestMatcherRegistry<T> { extends AbstractConfigAttributeRequestMatcherRegistry<T> {
@ -195,4 +195,4 @@ abstract class AbstractInterceptUrlConfigurer<C extends AbstractInterceptUrlConf
securityInterceptor.afterPropertiesSet(); securityInterceptor.afterPropertiesSet();
return securityInterceptor; return securityInterceptor;
} }
} }

View File

@ -183,8 +183,8 @@ public final class ExpressionUrlAuthorizationConfigurer<H extends HttpSecurityBu
@Override @Override
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
final List<AccessDecisionVoter<? extends Object>> getDecisionVoters(H http) { final List<AccessDecisionVoter<?>> getDecisionVoters(H http) {
List<AccessDecisionVoter<? extends Object>> decisionVoters = new ArrayList<>(); List<AccessDecisionVoter<?>> decisionVoters = new ArrayList<>();
WebExpressionVoter expressionVoter = new WebExpressionVoter(); WebExpressionVoter expressionVoter = new WebExpressionVoter();
expressionVoter.setExpressionHandler(getExpressionHandler(http)); expressionVoter.setExpressionHandler(getExpressionHandler(http));
decisionVoters.add(expressionVoter); decisionVoters.add(expressionVoter);

View File

@ -172,8 +172,8 @@ public final class UrlAuthorizationConfigurer<H extends HttpSecurityBuilder<H>>
*/ */
@Override @Override
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
final List<AccessDecisionVoter<? extends Object>> getDecisionVoters(H http) { final List<AccessDecisionVoter<?>> getDecisionVoters(H http) {
List<AccessDecisionVoter<? extends Object>> decisionVoters = new ArrayList<>(); List<AccessDecisionVoter<?>> decisionVoters = new ArrayList<>();
decisionVoters.add(new RoleVoter()); decisionVoters.add(new RoleVoter());
decisionVoters.add(new AuthenticatedVoter()); decisionVoters.add(new AuthenticatedVoter());
return decisionVoters; return decisionVoters;

View File

@ -159,7 +159,7 @@ public abstract class AbstractSecurityWebSocketMessageBrokerConfigurer extends
MessageExpressionVoter<Object> voter = new MessageExpressionVoter<>(); MessageExpressionVoter<Object> voter = new MessageExpressionVoter<>();
voter.setExpressionHandler(getMessageExpressionHandler()); voter.setExpressionHandler(getMessageExpressionHandler());
List<AccessDecisionVoter<? extends Object>> voters = new ArrayList<>(); List<AccessDecisionVoter<?>> voters = new ArrayList<>();
voters.add(voter); voters.add(voter);
AffirmativeBased manager = new AffirmativeBased(voters); AffirmativeBased manager = new AffirmativeBased(voters);

View File

@ -45,14 +45,14 @@ public abstract class AbstractAccessDecisionManager implements AccessDecisionMan
// ================================================================================================ // ================================================================================================
protected final Log logger = LogFactory.getLog(getClass()); protected final Log logger = LogFactory.getLog(getClass());
private List<AccessDecisionVoter<? extends Object>> decisionVoters; private List<AccessDecisionVoter<?>> decisionVoters;
protected MessageSourceAccessor messages = SpringSecurityMessageSource.getAccessor(); protected MessageSourceAccessor messages = SpringSecurityMessageSource.getAccessor();
private boolean allowIfAllAbstainDecisions = false; private boolean allowIfAllAbstainDecisions = false;
protected AbstractAccessDecisionManager( protected AbstractAccessDecisionManager(
List<AccessDecisionVoter<? extends Object>> decisionVoters) { List<AccessDecisionVoter<?>> decisionVoters) {
Assert.notEmpty(decisionVoters, "A list of AccessDecisionVoters is required"); Assert.notEmpty(decisionVoters, "A list of AccessDecisionVoters is required");
this.decisionVoters = decisionVoters; this.decisionVoters = decisionVoters;
} }
@ -72,7 +72,7 @@ public abstract class AbstractAccessDecisionManager implements AccessDecisionMan
} }
} }
public List<AccessDecisionVoter<? extends Object>> getDecisionVoters() { public List<AccessDecisionVoter<?>> getDecisionVoters() {
return this.decisionVoters; return this.decisionVoters;
} }

View File

@ -30,7 +30,7 @@ import org.springframework.security.core.Authentication;
*/ */
public class AffirmativeBased extends AbstractAccessDecisionManager { public class AffirmativeBased extends AbstractAccessDecisionManager {
public AffirmativeBased(List<AccessDecisionVoter<? extends Object>> decisionVoters) { public AffirmativeBased(List<AccessDecisionVoter<?>> decisionVoters) {
super(decisionVoters); super(decisionVoters);
} }

View File

@ -38,7 +38,7 @@ public class ConsensusBased extends AbstractAccessDecisionManager {
private boolean allowIfEqualGrantedDeniedDecisions = true; private boolean allowIfEqualGrantedDeniedDecisions = true;
public ConsensusBased(List<AccessDecisionVoter<? extends Object>> decisionVoters) { public ConsensusBased(List<AccessDecisionVoter<?>> decisionVoters) {
super(decisionVoters); super(decisionVoters);
} }

View File

@ -32,7 +32,7 @@ import org.springframework.security.core.Authentication;
*/ */
public class UnanimousBased extends AbstractAccessDecisionManager { public class UnanimousBased extends AbstractAccessDecisionManager {
public UnanimousBased(List<AccessDecisionVoter<? extends Object>> decisionVoters) { public UnanimousBased(List<AccessDecisionVoter<?>> decisionVoters) {
super(decisionVoters); super(decisionVoters);
} }

View File

@ -37,7 +37,7 @@ public interface MessageMatcher<T> {
*/ */
MessageMatcher<Object> ANY_MESSAGE = new MessageMatcher<Object>() { MessageMatcher<Object> ANY_MESSAGE = new MessageMatcher<Object>() {
@Override @Override
public boolean matches(Message<? extends Object> message) { public boolean matches(Message<?> message) {
return true; return true;
} }

View File

@ -120,7 +120,7 @@ public final class SimpDestinationMessageMatcher implements MessageMatcher<Objec
this.pattern = pattern; this.pattern = pattern;
} }
public boolean matches(Message<? extends Object> message) { public boolean matches(Message<?> message) {
if (!messageTypeMatcher.matches(message)) { if (!messageTypeMatcher.matches(message)) {
return false; return false;
} }
@ -131,7 +131,7 @@ public final class SimpDestinationMessageMatcher implements MessageMatcher<Objec
} }
public Map<String, String> extractPathVariables(Message<? extends Object> message){ public Map<String, String> extractPathVariables(Message<?> message){
final String destination = SimpMessageHeaderAccessor.getDestination(message final String destination = SimpMessageHeaderAccessor.getDestination(message
.getHeaders()); .getHeaders());
return destination != null ? matcher.extractUriTemplateVariables(pattern, destination) return destination != null ? matcher.extractUriTemplateVariables(pattern, destination)

View File

@ -45,7 +45,7 @@ public class SimpMessageTypeMatcher implements MessageMatcher<Object> {
} }
@Override @Override
public boolean matches(Message<? extends Object> message) { public boolean matches(Message<?> message) {
MessageHeaders headers = message.getHeaders(); MessageHeaders headers = message.getHeaders();
SimpMessageType messageType = SimpMessageHeaderAccessor.getMessageType(headers); SimpMessageType messageType = SimpMessageHeaderAccessor.getMessageType(headers);