Cleanup Code Style Issues

Cleanup Code Style Issues
This commit is contained in:
Rob Winch
2019-08-12 13:06:49 -05:00
committed by GitHub
172 changed files with 288 additions and 306 deletions

View File

@@ -55,5 +55,5 @@ public @interface Secured {
*
* @return String[] The secure method attributes
*/
public String[] value();
String[] value();
}

View File

@@ -48,11 +48,11 @@ class MethodSecurityEvaluationContext extends StandardEvaluationContext {
* for each instance. Use the constructor which takes the resolver, as an argument
* thus allowing for caching.
*/
public MethodSecurityEvaluationContext(Authentication user, MethodInvocation mi) {
MethodSecurityEvaluationContext(Authentication user, MethodInvocation mi) {
this(user, mi, new DefaultSecurityParameterNameDiscoverer());
}
public MethodSecurityEvaluationContext(Authentication user, MethodInvocation mi,
MethodSecurityEvaluationContext(Authentication user, MethodInvocation mi,
ParameterNameDiscoverer parameterNameDiscoverer) {
this.mi = mi;
this.parameterNameDiscoverer = parameterNameDiscoverer;

View File

@@ -40,7 +40,7 @@ public interface RoleHierarchy {
* @param authorities - List of the directly assigned authorities.
* @return List of all reachable authorities given the assigned authorities.
*/
public Collection<? extends GrantedAuthority> getReachableGrantedAuthorities(
Collection<? extends GrantedAuthority> getReachableGrantedAuthorities(
Collection<? extends GrantedAuthority> authorities);
}

View File

@@ -116,7 +116,7 @@ public final class DelegatingMethodSecurityMetadataSource extends
private final Method method;
private final Class<?> targetClass;
public DefaultCacheKey(Method method, Class<?> targetClass) {
DefaultCacheKey(Method method, Class<?> targetClass) {
this.method = method;
this.targetClass = targetClass;
}

View File

@@ -287,7 +287,7 @@ public class MapBasedMethodSecurityMetadataSource extends
private final Method method;
private final Class<?> registeredJavaType;
public RegisteredMethod(Method method, Class<?> registeredJavaType) {
RegisteredMethod(Method method, Class<?> registeredJavaType) {
Assert.notNull(method, "Method required");
Assert.notNull(registeredJavaType, "Registered Java Type required");
this.method = method;

View File

@@ -29,5 +29,5 @@ import org.springframework.security.access.SecurityMetadataSource;
* @author Ben Alex
*/
public interface MethodSecurityMetadataSource extends SecurityMetadataSource {
public Collection<ConfigAttribute> getAttributes(Method method, Class<?> targetClass);
Collection<ConfigAttribute> getAttributes(Method method, Class<?> targetClass);
}

View File

@@ -38,5 +38,5 @@ public @interface PostAuthorize {
* @return the Spring-EL expression to be evaluated after invoking the protected
* method
*/
public String value();
String value();
}

View File

@@ -38,5 +38,5 @@ public @interface PostFilter {
* @return the Spring-EL expression to be evaluated after invoking the protected
* method
*/
public String value();
String value();
}

View File

@@ -50,12 +50,12 @@ public @interface PreFilter {
* @return the Spring-EL expression to be evaluated before invoking the protected
* method
*/
public String value();
String value();
/**
* @return the name of the parameter which should be filtered (must be a non-null
* collection instance) If the method contains a single collection argument, then this
* attribute can be omitted.
*/
public String filterTarget() default "";
String filterTarget() default "";
}

View File

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

View File

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

View File

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

View File

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

View File

@@ -402,7 +402,7 @@ public abstract class AbstractJaasAuthenticationProvider
private class InternalCallbackHandler implements CallbackHandler {
private final Authentication authentication;
public InternalCallbackHandler(Authentication authentication) {
InternalCallbackHandler(Authentication authentication) {
this.authentication = authentication;
}

View File

@@ -61,24 +61,24 @@ public final class DelegatingSecurityContextScheduledExecutorService extends
this(delegate, null);
}
public final ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit) {
public ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit) {
command = wrap(command);
return getDelegate().schedule(command, delay, unit);
}
public final <V> ScheduledFuture<V> schedule(Callable<V> callable, long delay,
public <V> ScheduledFuture<V> schedule(Callable<V> callable, long delay,
TimeUnit unit) {
callable = wrap(callable);
return getDelegate().schedule(callable, delay, unit);
}
public final ScheduledFuture<?> scheduleAtFixedRate(Runnable command,
public ScheduledFuture<?> scheduleAtFixedRate(Runnable command,
long initialDelay, long period, TimeUnit unit) {
command = wrap(command);
return getDelegate().scheduleAtFixedRate(command, initialDelay, period, unit);
}
public final ScheduledFuture<?> scheduleWithFixedDelay(Runnable command,
public ScheduledFuture<?> scheduleWithFixedDelay(Runnable command,
long initialDelay, long delay, TimeUnit unit) {
command = wrap(command);
return getDelegate().scheduleWithFixedDelay(command, initialDelay, delay, unit);
@@ -87,4 +87,4 @@ public final class DelegatingSecurityContextScheduledExecutorService extends
private ScheduledExecutorService getDelegate() {
return (ScheduledExecutorService) getDelegateExecutor();
}
}
}

View File

@@ -92,9 +92,9 @@ class ComparableVersion implements Comparable<ComparableVersion> {
private ListItem items;
private interface Item {
final int INTEGER_ITEM = 0;
final int STRING_ITEM = 1;
final int LIST_ITEM = 2;
int INTEGER_ITEM = 0;
int STRING_ITEM = 1;
int LIST_ITEM = 2;
int compareTo(Item item);
@@ -117,7 +117,7 @@ class ComparableVersion implements Comparable<ComparableVersion> {
this.value = BigInteger_ZERO;
}
public IntegerItem(String str) {
IntegerItem(String str) {
this.value = new BigInteger(str);
}
@@ -184,7 +184,7 @@ class ComparableVersion implements Comparable<ComparableVersion> {
private String value;
public StringItem(String value, boolean followedByDigit) {
StringItem(String value, boolean followedByDigit) {
if (followedByDigit && value.length() == 1) {
// a1 = alpha-1, b1 = beta-1, m1 = milestone-1
switch (value.charAt(0)) {
@@ -341,7 +341,7 @@ class ComparableVersion implements Comparable<ComparableVersion> {
}
}
public ComparableVersion(String version) {
ComparableVersion(String version) {
parseVersion(version);
}

View File

@@ -37,6 +37,6 @@ public interface Attributes2GrantedAuthoritiesMapper {
* @param attributes the attributes to be mapped
* @return the collection of authorities created from the attributes
*/
public Collection<? extends GrantedAuthority> getGrantedAuthorities(
Collection<? extends GrantedAuthority> getGrantedAuthorities(
Collection<String> attributes);
}

View File

@@ -83,7 +83,7 @@ public class KeyBasedPersistenceTokenService implements TokenService, Initializi
long creationTime = new Date().getTime();
String serverSecret = computeServerSecretApplicableAt(creationTime);
String pseudoRandomNumber = generatePseudoRandomNumber();
String content = Long.toString(creationTime) + ":" + pseudoRandomNumber + ":"
String content = creationTime + ":" + pseudoRandomNumber + ":"
+ extendedInformation;
// Compute key
@@ -126,7 +126,7 @@ public class KeyBasedPersistenceTokenService implements TokenService, Initializi
String sha1Hex = tokens[tokens.length - 1];
// Verification
String content = Long.toString(creationTime) + ":" + pseudoRandomNumber + ":"
String content = creationTime + ":" + pseudoRandomNumber + ":"
+ extendedInfo.toString();
String expectedSha512Hex = Sha512DigestUtils.shaHex(content + ":" + serverSecret);
Assert.isTrue(expectedSha512Hex.equals(sha1Hex), "Key verification failure");

View File

@@ -53,7 +53,7 @@ class AnonymousAuthenticationTokenMixin {
* @param authorities the authorities granted to the principal
*/
@JsonCreator
public AnonymousAuthenticationTokenMixin(@JsonProperty("keyHash") Integer keyHash, @JsonProperty("principal") Object principal,
AnonymousAuthenticationTokenMixin(@JsonProperty("keyHash") Integer keyHash, @JsonProperty("principal") Object principal,
@JsonProperty("authorities") Collection<? extends GrantedAuthority> authorities) {
}
}

View File

@@ -59,7 +59,7 @@ class RememberMeAuthenticationTokenMixin {
* @param authorities the authorities granted to the principal
*/
@JsonCreator
public RememberMeAuthenticationTokenMixin(@JsonProperty("keyHash") Integer keyHash,
RememberMeAuthenticationTokenMixin(@JsonProperty("keyHash") Integer keyHash,
@JsonProperty("principal") Object principal,
@JsonProperty("authorities") Collection<? extends GrantedAuthority> authorities) {
}

View File

@@ -152,7 +152,7 @@ public final class SecurityJackson2Modules {
*/
static class WhitelistTypeResolverBuilder extends ObjectMapper.DefaultTypeResolverBuilder {
public WhitelistTypeResolverBuilder(ObjectMapper.DefaultTyping defaultTyping) {
WhitelistTypeResolverBuilder(ObjectMapper.DefaultTyping defaultTyping) {
super(defaultTyping);
}

View File

@@ -33,7 +33,7 @@ class MutableUser implements MutableUserDetails {
private String password;
private final UserDetails delegate;
public MutableUser(UserDetails user) {
MutableUser(UserDetails user) {
this.delegate = user;
this.password = user.getPassword();
}

View File

@@ -92,7 +92,7 @@ public class SecurityConfigTests {
private class MockConfigAttribute implements ConfigAttribute {
private String attribute;
public MockConfigAttribute(String configuration) {
MockConfigAttribute(String configuration) {
this.attribute = configuration;
}

View File

@@ -35,31 +35,31 @@ public interface BusinessService extends Serializable {
@Secured({ "ROLE_ADMIN" })
@RolesAllowed({ "ROLE_ADMIN" })
@PreAuthorize("hasRole('ROLE_ADMIN')")
public void someAdminMethod();
void someAdminMethod();
@Secured({ "ROLE_USER", "ROLE_ADMIN" })
@RolesAllowed({ "ROLE_USER", "ROLE_ADMIN" })
public void someUserAndAdminMethod();
void someUserAndAdminMethod();
@Secured({ "ROLE_USER" })
@RolesAllowed({ "ROLE_USER" })
public void someUserMethod1();
void someUserMethod1();
@Secured({ "ROLE_USER" })
@RolesAllowed({ "ROLE_USER" })
public void someUserMethod2();
void someUserMethod2();
@RolesAllowed({ "USER" })
public void rolesAllowedUser();
void rolesAllowedUser();
public int someOther(String s);
int someOther(String s);
public int someOther(int input);
int someOther(int input);
public List<?> methodReturningAList(List<?> someList);
List<?> methodReturningAList(List<?> someList);
public Object[] methodReturningAnArray(Object[] someArray);
Object[] methodReturningAnArray(Object[] someArray);
public List<?> methodReturningAList(String userName, String extraParam);
List<?> methodReturningAList(String userName, String extraParam);
}

View File

@@ -218,7 +218,7 @@ public class SecuredAnnotationSecurityMetadataSourceTests {
// Inner classes
class Department extends Entity {
public Department(String name) {
Department(String name) {
super(name);
}
}
@@ -285,15 +285,15 @@ public class SecuredAnnotationSecurityMetadataSourceTests {
public @interface AnnotatedAnnotation {
}
public static interface ReturnVoid {
public interface ReturnVoid {
public void doSomething(List<?> param);
void doSomething(List<?> param);
}
@AnnotatedAnnotation
public static interface ReturnVoid2 {
public interface ReturnVoid2 {
public void doSomething(List<?> param);
void doSomething(List<?> param);
}
@AnnotatedAnnotation

View File

@@ -58,7 +58,7 @@ public class MethodSecurityEvaluationContextTests {
private static class NotNullVariableMethodSecurityEvaluationContext
extends MethodSecurityEvaluationContext {
public NotNullVariableMethodSecurityEvaluationContext(Authentication auth, MethodInvocation mi,
NotNullVariableMethodSecurityEvaluationContext(Authentication auth, MethodInvocation mi,
ParameterNameDiscoverer parameterNameDiscoverer) {
super(auth, mi, parameterNameDiscoverer);
}

View File

@@ -203,19 +203,19 @@ public class PrePostAnnotationSecurityMetadataSourceTests {
// ~ Inner Classes
// ==================================================================================================
public static interface ReturnVoid {
public void doSomething(List<?> param);
public interface ReturnVoid {
void doSomething(List<?> param);
}
public static interface ReturnAList {
public List<?> doSomething(List<?> param);
public interface ReturnAList {
List<?> doSomething(List<?> param);
}
@PreAuthorize("interfaceAuthzExpression")
public static interface ReturnAnotherList {
public interface ReturnAnotherList {
@PreAuthorize("interfaceMethodAuthzExpression")
@PreFilter(filterTarget = "param", value = "interfacePreFilterExpression")
public List<?> doSomething(List<?> param);
List<?> doSomething(List<?> param);
}
@PreAuthorize("someExpression")
@@ -275,8 +275,8 @@ public class PrePostAnnotationSecurityMetadataSourceTests {
}
@CustomAnnotation
public static interface ReturnVoid2 {
public void doSomething(List<?> param);
public interface ReturnVoid2 {
void doSomething(List<?> param);
}
@CustomAnnotation

View File

@@ -179,8 +179,7 @@ public class AfterInvocationProviderManagerTests {
private Object forceReturnObject;
public MockAfterInvocationProvider(Object forceReturnObject, Class secureObject,
ConfigAttribute configAttribute) {
MockAfterInvocationProvider(Object forceReturnObject, Class secureObject, ConfigAttribute configAttribute) {
this.forceReturnObject = forceReturnObject;
this.secureObject = secureObject;
this.configAttribute = configAttribute;

View File

@@ -156,8 +156,7 @@ public class AbstractAuthenticationTokenTests {
private Object credentials;
private Object principal;
public MockAuthenticationImpl(Object principal, Object credentials,
List<GrantedAuthority> authorities) {
MockAuthenticationImpl(Object principal, Object credentials, List<GrantedAuthority> authorities) {
super(authorities);
this.principal = principal;
this.credentials = credentials;

View File

@@ -139,7 +139,7 @@ public class DefaultAuthenticationEventPublisherTests {
private static final class MockAuthenticationException extends
AuthenticationException {
public MockAuthenticationException(String msg) {
MockAuthenticationException(String msg) {
super(msg);
}
}

View File

@@ -290,7 +290,7 @@ public class JaasAuthenticationProviderTests {
private static class MockLoginContext extends LoginContext {
boolean loggedOut = false;
public MockLoginContext(String loginModule) throws LoginException {
MockLoginContext(String loginModule) throws LoginException {
super(loginModule);
}

View File

@@ -119,7 +119,7 @@ public class RemoteAuthenticationProviderTests {
private class MockRemoteAuthenticationManager implements RemoteAuthenticationManager {
private boolean grantAccess;
public MockRemoteAuthenticationManager(boolean grantAccess) {
MockRemoteAuthenticationManager(boolean grantAccess) {
this.grantAccess = grantAccess;
}

View File

@@ -62,8 +62,8 @@ public class DelegatingSecurityContextSupportTests extends
private static class ConcreteDelegatingSecurityContextSupport extends
AbstractDelegatingSecurityContextSupport {
public ConcreteDelegatingSecurityContextSupport(SecurityContext securityContext) {
ConcreteDelegatingSecurityContextSupport(SecurityContext securityContext) {
super(securityContext);
}
}
}
}

View File

@@ -78,13 +78,13 @@ public class AnnotationParameterNameDiscovererTests {
@Test
public void getParameterNamesConstructor() throws Exception {
assertThat(discoverer.getParameterNames(Impl.class.getConstructor(String.class)))
assertThat(discoverer.getParameterNames(Impl.class.getDeclaredConstructor(String.class)))
.isEqualTo(new String[] { "id" });
}
@Test
public void getParameterNamesConstructorNoAnnotation() throws Exception {
assertThat(discoverer.getParameterNames(Impl.class.getConstructor(Long.class)))
assertThat(discoverer.getParameterNames(Impl.class.getDeclaredConstructor(Long.class)))
.isNull();
}
@@ -148,10 +148,10 @@ public class AnnotationParameterNameDiscovererTests {
}
static class Impl {
public Impl(Long dataSourceId) {
Impl(Long dataSourceId) {
}
public Impl(@P("id") String dataSourceId) {
Impl(@P("id") String dataSourceId) {
}
String findMessageByTo(@P("to") String to) {