Cleanup redundant type casts

This commit is contained in:
Lars Grefer
2019-07-04 19:04:19 +02:00
committed by Rob Winch
parent 43737a56bd
commit c5b5cc507c
31 changed files with 38 additions and 42 deletions

View File

@@ -23,7 +23,7 @@ public final class ExpressionUtils {
public static boolean evaluateAsBoolean(Expression expr, EvaluationContext ctx) {
try {
return ((Boolean) expr.getValue(ctx, Boolean.class)).booleanValue();
return expr.getValue(ctx, Boolean.class).booleanValue();
}
catch (EvaluationException e) {
throw new IllegalArgumentException("Failed to evaluate expression '"

View File

@@ -98,7 +98,7 @@ public class MapBasedMethodSecurityMetadataSource extends
Class<?> clazz) {
RegisteredMethod registeredMethod = new RegisteredMethod(method, clazz);
if (methodMap.containsKey(registeredMethod)) {
return (List<ConfigAttribute>) methodMap.get(registeredMethod);
return methodMap.get(registeredMethod);
}
// Search superclass
if (clazz.getSuperclass() != null) {
@@ -166,7 +166,7 @@ public class MapBasedMethodSecurityMetadataSource extends
// register all matching methods
for (Method method : matchingMethods) {
RegisteredMethod registeredMethod = new RegisteredMethod(method, javaType);
String regMethodName = (String) this.nameMap.get(registeredMethod);
String regMethodName = this.nameMap.get(registeredMethod);
if ((regMethodName == null)
|| (!regMethodName.equals(name) && (regMethodName.length() <= name

View File

@@ -17,7 +17,6 @@
package org.springframework.security.jackson2;
import com.fasterxml.jackson.core.Version;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import org.springframework.security.authentication.AnonymousAuthenticationToken;
import org.springframework.security.authentication.BadCredentialsException;
@@ -54,7 +53,7 @@ public class CoreJackson2Module extends SimpleModule {
@Override
public void setupModule(SetupContext context) {
SecurityJackson2Modules.enableDefaultTyping((ObjectMapper) context.getOwner());
SecurityJackson2Modules.enableDefaultTyping(context.getOwner());
context.setMixInAnnotations(AnonymousAuthenticationToken.class, AnonymousAuthenticationTokenMixin.class);
context.setMixInAnnotations(RememberMeAuthenticationToken.class, RememberMeAuthenticationTokenMixin.class);
context.setMixInAnnotations(SimpleGrantedAuthority.class, SimpleGrantedAuthorityMixin.class);