1
0
mirror of synced 2026-08-05 01:36:56 +00:00

Add missing @Override annotations

This commit also adds MissingOverrideCheck module to Checkstyle configuration.
This commit is contained in:
Johnny Lim
2017-11-01 22:28:29 +09:00
committed by Rob Winch
parent be0c6cde3d
commit 99df632f24
44 changed files with 184 additions and 4 deletions
@@ -44,6 +44,7 @@ public class SecurityConfig implements ConfigAttribute {
// ~ Methods
// ========================================================================================================
@Override
public boolean equals(Object obj) {
if (obj instanceof ConfigAttribute) {
ConfigAttribute attr = (ConfigAttribute) obj;
@@ -54,14 +55,17 @@ public class SecurityConfig implements ConfigAttribute {
return false;
}
@Override
public String getAttribute() {
return this.attrib;
}
@Override
public int hashCode() {
return this.attrib.hashCode();
}
@Override
public String toString() {
return this.attrib;
}
@@ -58,6 +58,7 @@ public class RunAsUserToken extends AbstractAuthenticationToken {
// ~ Methods
// ========================================================================================================
@Override
public Object getCredentials() {
return this.credentials;
}
@@ -70,10 +71,12 @@ public class RunAsUserToken extends AbstractAuthenticationToken {
return this.originalAuthentication;
}
@Override
public Object getPrincipal() {
return this.principal;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder(super.toString());
String className = this.originalAuthentication == null ? null
@@ -93,6 +93,7 @@ public final class DelegatingMethodSecurityMetadataSource extends
}
}
@Override
public Collection<ConfigAttribute> getAllConfigAttributes() {
Set<ConfigAttribute> set = new HashSet<ConfigAttribute>();
for (MethodSecurityMetadataSource s : methodSecurityMetadataSources) {
@@ -120,17 +121,20 @@ public final class DelegatingMethodSecurityMetadataSource extends
this.targetClass = targetClass;
}
@Override
public boolean equals(Object other) {
DefaultCacheKey otherKey = (DefaultCacheKey) other;
return (this.method.equals(otherKey.method) && ObjectUtils.nullSafeEquals(
this.targetClass, otherKey.targetClass));
}
@Override
public int hashCode() {
return this.method.hashCode() * 21
+ (this.targetClass != null ? this.targetClass.hashCode() : 0);
}
@Override
public String toString() {
return "CacheKey[" + (targetClass == null ? "-" : targetClass.getName())
+ "; " + method + "]";
@@ -75,6 +75,7 @@ public class MapBasedMethodSecurityMetadataSource extends
/**
* Implementation does not support class-level attributes.
*/
@Override
protected Collection<ConfigAttribute> findAttributes(Class<?> clazz) {
return null;
}
@@ -83,6 +84,7 @@ public class MapBasedMethodSecurityMetadataSource extends
* Will walk the method inheritance tree to find the most specific declaration
* applicable.
*/
@Override
protected Collection<ConfigAttribute> findAttributes(Method method,
Class<?> targetClass) {
if (targetClass == null) {
@@ -232,6 +234,7 @@ public class MapBasedMethodSecurityMetadataSource extends
*
* @return the attributes explicitly defined against this bean
*/
@Override
public Collection<ConfigAttribute> getAllConfigAttributes() {
Set<ConfigAttribute> allAttributes = new HashSet<ConfigAttribute>();
@@ -258,6 +261,7 @@ public class MapBasedMethodSecurityMetadataSource extends
.substring(1, mappedName.length())));
}
@Override
public void setBeanClassLoader(ClassLoader beanClassLoader) {
Assert.notNull(beanClassLoader, "Bean class loader required");
this.beanClassLoader = beanClassLoader;
@@ -290,6 +294,7 @@ public class MapBasedMethodSecurityMetadataSource extends
this.registeredJavaType = registeredJavaType;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
@@ -302,10 +307,12 @@ public class MapBasedMethodSecurityMetadataSource extends
return false;
}
@Override
public int hashCode() {
return method.hashCode() * registeredJavaType.hashCode();
}
@Override
public String toString() {
return "RegisteredMethod[" + registeredJavaType.getName() + "; " + method
+ "]";
@@ -82,6 +82,7 @@ public class AnonymousAuthenticationToken extends AbstractAuthenticationToken im
return key.hashCode();
}
@Override
public boolean equals(Object obj) {
if (!super.equals(obj)) {
return false;
@@ -112,6 +113,7 @@ public class AnonymousAuthenticationToken extends AbstractAuthenticationToken im
*
* @return an empty String
*/
@Override
public Object getCredentials() {
return "";
}
@@ -120,6 +122,7 @@ public class AnonymousAuthenticationToken extends AbstractAuthenticationToken im
return this.keyHash;
}
@Override
public Object getPrincipal() {
return this.principal;
}
@@ -90,6 +90,7 @@ public class RememberMeAuthenticationToken extends AbstractAuthenticationToken {
*
* @return an empty String
*/
@Override
public Object getCredentials() {
return "";
}
@@ -98,10 +99,12 @@ public class RememberMeAuthenticationToken extends AbstractAuthenticationToken {
return this.keyHash;
}
@Override
public Object getPrincipal() {
return this.principal;
}
@Override
public boolean equals(Object obj) {
if (!super.equals(obj)) {
return false;
@@ -48,14 +48,17 @@ public final class JaasGrantedAuthority implements GrantedAuthority {
return principal;
}
@Override
public String getAuthority() {
return role;
}
@Override
public int hashCode() {
return 31 ^ principal.hashCode() ^ role.hashCode();
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
@@ -69,6 +72,7 @@ public final class JaasGrantedAuthority implements GrantedAuthority {
return false;
}
@Override
public String toString() {
return "Jaas Authority [" + role + "," + principal + "]";
}
@@ -78,6 +78,7 @@ public final class DelegatingSecurityContextCallable<V> implements Callable<V> {
this(delegate, SecurityContextHolder.getContext());
}
@Override
public V call() throws Exception {
this.originalSecurityContext = SecurityContextHolder.getContext();
@@ -96,6 +97,7 @@ public final class DelegatingSecurityContextCallable<V> implements Callable<V> {
}
}
@Override
public String toString() {
return delegate.toString();
}
@@ -75,6 +75,7 @@ public final class DelegatingSecurityContextRunnable implements Runnable {
this(delegate, SecurityContextHolder.getContext());
}
@Override
public void run() {
this.originalSecurityContext = SecurityContextHolder.getContext();
@@ -93,6 +94,7 @@ public final class DelegatingSecurityContextRunnable implements Runnable {
}
}
@Override
public String toString() {
return delegate.toString();
}
@@ -121,14 +121,17 @@ class ComparableVersion implements Comparable<ComparableVersion> {
this.value = new BigInteger(str);
}
@Override
public int getType() {
return INTEGER_ITEM;
}
@Override
public boolean isNull() {
return BigInteger_ZERO.equals(value);
}
@Override
public int compareTo(Item item) {
if (item == null) {
return BigInteger_ZERO.equals(value) ? 0 : 1; // 1.0 == 1, 1.1 > 1
@@ -149,6 +152,7 @@ class ComparableVersion implements Comparable<ComparableVersion> {
}
}
@Override
public String toString() {
return value.toString();
}
@@ -198,10 +202,12 @@ class ComparableVersion implements Comparable<ComparableVersion> {
this.value = ALIASES.getProperty(value, value);
}
@Override
public int getType() {
return STRING_ITEM;
}
@Override
public boolean isNull() {
return (comparableQualifier(value).compareTo(RELEASE_VERSION_INDEX) == 0);
}
@@ -226,6 +232,7 @@ class ComparableVersion implements Comparable<ComparableVersion> {
return i == -1 ? (_QUALIFIERS.size() + "-" + qualifier) : String.valueOf(i);
}
@Override
public int compareTo(Item item) {
if (item == null) {
// 1-rc < 1, 1-ga > 1
@@ -247,6 +254,7 @@ class ComparableVersion implements Comparable<ComparableVersion> {
}
}
@Override
public String toString() {
return value;
}
@@ -257,10 +265,12 @@ class ComparableVersion implements Comparable<ComparableVersion> {
* and for sub-lists (which start with '-(number)' in the version specification).
*/
private static class ListItem extends ArrayList<Item> implements Item {
@Override
public int getType() {
return LIST_ITEM;
}
@Override
public boolean isNull() {
return (size() == 0);
}
@@ -278,6 +288,7 @@ class ComparableVersion implements Comparable<ComparableVersion> {
}
}
@Override
public int compareTo(Item item) {
if (item == null) {
if (size() == 0) {
@@ -316,6 +327,7 @@ class ComparableVersion implements Comparable<ComparableVersion> {
}
}
@Override
public String toString() {
StringBuilder buffer = new StringBuilder("(");
for (Iterator<Item> iter = iterator(); iter.hasNext();) {
@@ -418,20 +430,24 @@ class ComparableVersion implements Comparable<ComparableVersion> {
return isDigit ? new IntegerItem(buf) : new StringItem(buf, false);
}
@Override
public int compareTo(ComparableVersion o) {
return items.compareTo(o.items);
}
@Override
public String toString() {
return value;
}
@Override
public boolean equals(Object o) {
return (o instanceof ComparableVersion)
&& canonical.equals(((ComparableVersion) o).canonical);
}
@Override
public int hashCode() {
return canonical.hashCode();
}
}
}
@@ -39,10 +39,12 @@ public final class SimpleGrantedAuthority implements GrantedAuthority {
this.role = role;
}
@Override
public String getAuthority() {
return role;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
@@ -55,10 +57,12 @@ public final class SimpleGrantedAuthority implements GrantedAuthority {
return false;
}
@Override
public int hashCode() {
return this.role.hashCode();
}
@Override
public String toString() {
return this.role;
}
@@ -161,6 +161,7 @@ public class SecurityContextHolder {
return strategy.createEmptyContext();
}
@Override
public String toString() {
return "SecurityContextHolder[strategy='" + strategyName + "'; initializeCount="
+ initializeCount + "]";
@@ -44,6 +44,7 @@ public class SecurityContextImpl implements SecurityContext {
// ~ Methods
// ========================================================================================================
@Override
public boolean equals(Object obj) {
if (obj instanceof SecurityContextImpl) {
SecurityContextImpl test = (SecurityContextImpl) obj;
@@ -61,10 +62,12 @@ public class SecurityContextImpl implements SecurityContext {
return false;
}
@Override
public Authentication getAuthentication() {
return authentication;
}
@Override
public int hashCode() {
if (this.authentication == null) {
return -1;
@@ -74,10 +77,12 @@ public class SecurityContextImpl implements SecurityContext {
}
}
@Override
public void setAuthentication(Authentication authentication) {
this.authentication = authentication;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(super.toString());
@@ -38,18 +38,22 @@ public class DefaultToken implements Token {
this.extendedInformation = extendedInformation;
}
@Override
public String getKey() {
return key;
}
@Override
public long getKeyCreationTime() {
return keyCreationTime;
}
@Override
public String getExtendedInformation() {
return extendedInformation;
}
@Override
public boolean equals(Object obj) {
if (obj != null && obj instanceof DefaultToken) {
DefaultToken rhs = (DefaultToken) obj;
@@ -60,6 +64,7 @@ public class DefaultToken implements Token {
return false;
}
@Override
public int hashCode() {
int code = 979;
code = code * key.hashCode();
@@ -68,6 +73,7 @@ public class DefaultToken implements Token {
return code;
}
@Override
public String toString() {
return "DefaultToken[key=" + key + "; creation=" + new Date(keyCreationTime)
+ "; extended=" + extendedInformation + "]";
@@ -60,18 +60,22 @@ public class InMemoryResource extends AbstractResource {
// ~ Methods
// ========================================================================================================
@Override
public String getDescription() {
return description;
}
@Override
public InputStream getInputStream() throws IOException {
return new ByteArrayInputStream(source);
}
@Override
public int hashCode() {
return 1;
}
@Override
public boolean equals(Object res) {
if (!(res instanceof InMemoryResource)) {
return false;