From 34ab7832c8ee8881ea80b3992423504d8b3aa8ac Mon Sep 17 00:00:00 2001 From: Arjen Poutsma Date: Mon, 27 Oct 2008 23:23:13 +0000 Subject: [PATCH] Reverted to r143, before IntelliJ screwed up the imports... --- .../core/AttributeAccessorSupport.java | 10 +++--- .../core/CollectionFactory.java | 26 ++++++++++++--- .../core/ConfigurableObjectInputStream.java | 10 +++--- .../core/ControlFlowFactory.java | 7 ++-- ...lVariableTableParameterNameDiscoverer.java | 26 ++++++++------- .../core/NamedInheritableThreadLocal.java | 3 +- .../core/NamedThreadLocal.java | 3 +- .../core/NestedCheckedException.java | 3 +- .../core/NestedIOException.java | 3 +- .../core/NestedRuntimeException.java | 3 +- .../core/OverridingClassLoader.java | 7 ++-- .../AnnotationAwareOrderComparator.java | 3 +- .../AbstractCachingLabeledEnumResolver.java | 16 +++++---- .../core/enums/AbstractLabeledEnum.java | 9 ++--- .../core/enums/StaticLabeledEnumResolver.java | 7 ++-- .../core/io/AbstractResource.java | 15 ++++----- .../core/io/ByteArrayResource.java | 9 ++--- .../core/io/ClassPathResource.java | 29 ++++++++-------- .../core/io/DefaultResourceLoader.java | 9 +++-- .../core/io/DescriptiveResource.java | 12 +++---- .../core/io/FileSystemResource.java | 33 +++++++------------ .../core/io/FileSystemResourceLoader.java | 3 +- .../core/io/InputStreamResource.java | 12 +++---- .../core/io/ResourceEditor.java | 12 +++---- .../springframework/core/io/UrlResource.java | 32 +++++++----------- .../core/io/support/EncodedResource.java | 17 ++++------ .../support/ResourceArrayPropertyEditor.java | 18 +++++----- .../core/style/ToStringCreator.java | 3 +- .../core/task/SimpleAsyncTaskExecutor.java | 10 +++--- .../AnnotationMetadataReadingVisitor.java | 22 +++++++------ .../CachingMetadataReaderFactory.java | 9 +++-- .../ClassMetadataReadingVisitor.java | 10 +++--- .../util/AutoPopulatingList.java | 12 ++++--- .../util/CachingMapDecorator.java | 13 ++++++-- .../util/CommonsLogWriter.java | 13 +++----- .../org/springframework/util/StopWatch.java | 3 +- .../util/comparator/BooleanComparator.java | 9 ++--- .../util/comparator/CompoundComparator.java | 13 +++----- .../util/comparator/InvertibleComparator.java | 9 ++--- .../util/comparator/NullSafeComparator.java | 13 +++----- 40 files changed, 217 insertions(+), 259 deletions(-) diff --git a/org.springframework.core/src/main/java/org/springframework/core/AttributeAccessorSupport.java b/org.springframework.core/src/main/java/org/springframework/core/AttributeAccessorSupport.java index f05f38e45d1..ece4a05862b 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/AttributeAccessorSupport.java +++ b/org.springframework.core/src/main/java/org/springframework/core/AttributeAccessorSupport.java @@ -16,13 +16,13 @@ package org.springframework.core; -import org.springframework.util.Assert; - import java.io.Serializable; import java.util.LinkedHashMap; import java.util.Map; import java.util.Set; +import org.springframework.util.Assert; + /** * Support class for {@link AttributeAccessor AttributeAccessors}, providing * a base implementation of all methods. To be extended by subclasses. @@ -84,8 +84,7 @@ public abstract class AttributeAccessorSupport implements AttributeAccessor, Ser } - @Override - public boolean equals(Object other) { + public boolean equals(Object other) { if (this == other) { return true; } @@ -96,8 +95,7 @@ public abstract class AttributeAccessorSupport implements AttributeAccessor, Ser return this.attributes.equals(that.attributes); } - @Override - public int hashCode() { + public int hashCode() { return this.attributes.hashCode(); } diff --git a/org.springframework.core/src/main/java/org/springframework/core/CollectionFactory.java b/org.springframework.core/src/main/java/org/springframework/core/CollectionFactory.java index 677329ea162..4044c987fca 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/CollectionFactory.java +++ b/org.springframework.core/src/main/java/org/springframework/core/CollectionFactory.java @@ -16,15 +16,33 @@ package org.springframework.core; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.IdentityHashMap; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.NavigableMap; +import java.util.NavigableSet; +import java.util.Set; +import java.util.SortedMap; +import java.util.SortedSet; +import java.util.TreeMap; +import java.util.TreeSet; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.CopyOnWriteArraySet; + import org.apache.commons.collections.map.CaseInsensitiveMap; import org.apache.commons.collections.map.ListOrderedMap; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.springframework.util.ClassUtils; -import java.util.*; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.CopyOnWriteArraySet; +import org.springframework.util.ClassUtils; /** * Factory for collections, being aware of Commons Collection 3.x's extended diff --git a/org.springframework.core/src/main/java/org/springframework/core/ConfigurableObjectInputStream.java b/org.springframework.core/src/main/java/org/springframework/core/ConfigurableObjectInputStream.java index 1ffaa1324f8..30b5f0cc29c 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/ConfigurableObjectInputStream.java +++ b/org.springframework.core/src/main/java/org/springframework/core/ConfigurableObjectInputStream.java @@ -16,14 +16,14 @@ package org.springframework.core; -import org.springframework.util.ClassUtils; - import java.io.IOException; import java.io.InputStream; import java.io.ObjectInputStream; import java.io.ObjectStreamClass; import java.lang.reflect.Proxy; +import org.springframework.util.ClassUtils; + /** * Special ObjectInputStream subclass that resolves class names * against a specific ClassLoader. Serves as base class for @@ -49,8 +49,7 @@ public class ConfigurableObjectInputStream extends ObjectInputStream { } - @Override - protected Class resolveClass(ObjectStreamClass classDesc) throws IOException, ClassNotFoundException { + protected Class resolveClass(ObjectStreamClass classDesc) throws IOException, ClassNotFoundException { try { if (this.classLoader != null) { // Use the specified ClassLoader to resolve local classes. @@ -66,8 +65,7 @@ public class ConfigurableObjectInputStream extends ObjectInputStream { } } - @Override - protected Class resolveProxyClass(String[] interfaces) throws IOException, ClassNotFoundException { + protected Class resolveProxyClass(String[] interfaces) throws IOException, ClassNotFoundException { if (this.classLoader != null) { // Use the specified ClassLoader to resolve local proxy classes. Class[] resolvedInterfaces = new Class[interfaces.length]; diff --git a/org.springframework.core/src/main/java/org/springframework/core/ControlFlowFactory.java b/org.springframework.core/src/main/java/org/springframework/core/ControlFlowFactory.java index fcbe1b5dc3e..ef10946ed6c 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/ControlFlowFactory.java +++ b/org.springframework.core/src/main/java/org/springframework/core/ControlFlowFactory.java @@ -16,11 +16,11 @@ package org.springframework.core; -import org.springframework.util.Assert; - import java.io.PrintWriter; import java.io.StringWriter; +import org.springframework.util.Assert; + /** * Static factory to conceal the automatic choice of the ControlFlow * implementation class. @@ -103,8 +103,7 @@ public abstract class ControlFlowFactory { return stackTrace.indexOf(token) != -1; } - @Override - public String toString() { + public String toString() { StringBuffer sb = new StringBuffer("Jdk14ControlFlow: "); for (int i = 0; i < this.stack.length; i++) { if (i > 0) { diff --git a/org.springframework.core/src/main/java/org/springframework/core/LocalVariableTableParameterNameDiscoverer.java b/org.springframework.core/src/main/java/org/springframework/core/LocalVariableTableParameterNameDiscoverer.java index 91b916b05ad..4a9033bc432 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/LocalVariableTableParameterNameDiscoverer.java +++ b/org.springframework.core/src/main/java/org/springframework/core/LocalVariableTableParameterNameDiscoverer.java @@ -16,12 +16,6 @@ package org.springframework.core; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.objectweb.asm.*; -import org.objectweb.asm.commons.EmptyVisitor; -import org.springframework.util.ClassUtils; - import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; @@ -31,6 +25,17 @@ import java.lang.reflect.Modifier; import java.util.HashMap; import java.util.Map; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.objectweb.asm.ClassReader; +import org.objectweb.asm.Label; +import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; +import org.objectweb.asm.Type; +import org.objectweb.asm.commons.EmptyVisitor; + +import org.springframework.util.ClassUtils; + /** * Implementation of {@link ParameterNameDiscoverer} that uses the LocalVariableTable * information in the method attributes to discover parameter names. Returns @@ -172,8 +177,7 @@ public class LocalVariableTableParameterNameDiscoverer implements ParameterNameD this.descriptorToMatch = descriptor; } - @Override - public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { + public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { if (name.equals(this.methodNameToMatch) && desc.equals(this.descriptorToMatch)) { return new LocalVariableTableVisitor(this, isStatic(access)); } @@ -249,8 +253,7 @@ public class LocalVariableTableParameterNameDiscoverer implements ParameterNameD this.parameterNames = new String[memberVisitor.numParamsExpected]; } - @Override - public void visitLocalVariable( + public void visitLocalVariable( String name, String description, String signature, Label start, Label end, int index) { this.hasLvtInfo = true; int[] lvtSlotIndices = this.memberVisitor.lvtSlotIndex; @@ -261,8 +264,7 @@ public class LocalVariableTableParameterNameDiscoverer implements ParameterNameD } } - @Override - public void visitEnd() { + public void visitEnd() { if (this.hasLvtInfo || (this.isStatic && this.parameterNames.length == 0)) { // visitLocalVariable will never be called for static no args methods // which doesn't use any local variables. diff --git a/org.springframework.core/src/main/java/org/springframework/core/NamedInheritableThreadLocal.java b/org.springframework.core/src/main/java/org/springframework/core/NamedInheritableThreadLocal.java index f3a7e042004..fa6c0d8bcfc 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/NamedInheritableThreadLocal.java +++ b/org.springframework.core/src/main/java/org/springframework/core/NamedInheritableThreadLocal.java @@ -40,8 +40,7 @@ public class NamedInheritableThreadLocal extends InheritableThreadLocal { this.name = name; } - @Override - public String toString() { + public String toString() { return this.name; } diff --git a/org.springframework.core/src/main/java/org/springframework/core/NamedThreadLocal.java b/org.springframework.core/src/main/java/org/springframework/core/NamedThreadLocal.java index feb68f9cb98..1b84aab8a4c 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/NamedThreadLocal.java +++ b/org.springframework.core/src/main/java/org/springframework/core/NamedThreadLocal.java @@ -40,8 +40,7 @@ public class NamedThreadLocal extends ThreadLocal { this.name = name; } - @Override - public String toString() { + public String toString() { return this.name; } diff --git a/org.springframework.core/src/main/java/org/springframework/core/NestedCheckedException.java b/org.springframework.core/src/main/java/org/springframework/core/NestedCheckedException.java index cb4040bf805..39361c6aad8 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/NestedCheckedException.java +++ b/org.springframework.core/src/main/java/org/springframework/core/NestedCheckedException.java @@ -63,8 +63,7 @@ public abstract class NestedCheckedException extends Exception { * Return the detail message, including the message from the nested exception * if there is one. */ - @Override - public String getMessage() { + public String getMessage() { return NestedExceptionUtils.buildMessage(super.getMessage(), getCause()); } diff --git a/org.springframework.core/src/main/java/org/springframework/core/NestedIOException.java b/org.springframework.core/src/main/java/org/springframework/core/NestedIOException.java index 2ad2c43a04f..25536da2987 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/NestedIOException.java +++ b/org.springframework.core/src/main/java/org/springframework/core/NestedIOException.java @@ -59,8 +59,7 @@ public class NestedIOException extends IOException { * Return the detail message, including the message from the nested exception * if there is one. */ - @Override - public String getMessage() { + public String getMessage() { return NestedExceptionUtils.buildMessage(super.getMessage(), getCause()); } diff --git a/org.springframework.core/src/main/java/org/springframework/core/NestedRuntimeException.java b/org.springframework.core/src/main/java/org/springframework/core/NestedRuntimeException.java index cfccc299a58..fb62c33fbdd 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/NestedRuntimeException.java +++ b/org.springframework.core/src/main/java/org/springframework/core/NestedRuntimeException.java @@ -63,8 +63,7 @@ public abstract class NestedRuntimeException extends RuntimeException { * Return the detail message, including the message from the nested exception * if there is one. */ - @Override - public String getMessage() { + public String getMessage() { return NestedExceptionUtils.buildMessage(super.getMessage(), getCause()); } diff --git a/org.springframework.core/src/main/java/org/springframework/core/OverridingClassLoader.java b/org.springframework.core/src/main/java/org/springframework/core/OverridingClassLoader.java index 6d1d8ed2d7c..b1ef1191d33 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/OverridingClassLoader.java +++ b/org.springframework.core/src/main/java/org/springframework/core/OverridingClassLoader.java @@ -16,11 +16,11 @@ package org.springframework.core; -import org.springframework.util.FileCopyUtils; - import java.io.IOException; import java.io.InputStream; +import org.springframework.util.FileCopyUtils; + /** * ClassLoader that does not always delegate to the * parent loader, as normal class loaders do. This enables, for example, @@ -54,8 +54,7 @@ public class OverridingClassLoader extends DecoratingClassLoader { } - @Override - protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException { + protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException { Class result = null; if (isEligibleForOverriding(name)) { result = loadClassForOverriding(name); diff --git a/org.springframework.core/src/main/java/org/springframework/core/annotation/AnnotationAwareOrderComparator.java b/org.springframework.core/src/main/java/org/springframework/core/annotation/AnnotationAwareOrderComparator.java index 738768c1bb5..817c3ce3091 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/annotation/AnnotationAwareOrderComparator.java +++ b/org.springframework.core/src/main/java/org/springframework/core/annotation/AnnotationAwareOrderComparator.java @@ -33,8 +33,7 @@ import org.springframework.core.Ordered; */ public class AnnotationAwareOrderComparator extends OrderComparator { - @Override - protected int getOrder(Object obj) { + protected int getOrder(Object obj) { if (obj instanceof Ordered) { return ((Ordered) obj).getOrder(); } diff --git a/org.springframework.core/src/main/java/org/springframework/core/enums/AbstractCachingLabeledEnumResolver.java b/org.springframework.core/src/main/java/org/springframework/core/enums/AbstractCachingLabeledEnumResolver.java index 21360b5c6c4..40eba4d3223 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/enums/AbstractCachingLabeledEnumResolver.java +++ b/org.springframework.core/src/main/java/org/springframework/core/enums/AbstractCachingLabeledEnumResolver.java @@ -16,14 +16,20 @@ package org.springframework.core.enums; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.springframework.util.Assert; import org.springframework.util.CachingMapDecorator; import org.springframework.util.ClassUtils; -import java.util.*; - /** * Abstract base class for {@link LabeledEnumResolver} implementations, * caching all retrieved {@link LabeledEnum} instances. @@ -42,8 +48,7 @@ public abstract class AbstractCachingLabeledEnumResolver implements LabeledEnumR private final CachingMapDecorator labeledEnumCache = new CachingMapDecorator(true) { - @Override - protected Object create(Object key) { + protected Object create(Object key) { Class enumType = (Class) key; Set typeEnums = findLabeledEnums(enumType); if (typeEnums == null || typeEnums.isEmpty()) { @@ -59,8 +64,7 @@ public abstract class AbstractCachingLabeledEnumResolver implements LabeledEnumR } return Collections.unmodifiableMap(typeEnumMap); } - @Override - protected boolean useWeakValue(Object key, Object value) { + protected boolean useWeakValue(Object key, Object value) { Class enumType = (Class) key; if (!ClassUtils.isCacheSafe(enumType, AbstractCachingLabeledEnumResolver.this.getClass().getClassLoader())) { if (logger.isDebugEnabled()) { diff --git a/org.springframework.core/src/main/java/org/springframework/core/enums/AbstractLabeledEnum.java b/org.springframework.core/src/main/java/org/springframework/core/enums/AbstractLabeledEnum.java index 1f68051595e..8081f8c3fe4 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/enums/AbstractLabeledEnum.java +++ b/org.springframework.core/src/main/java/org/springframework/core/enums/AbstractLabeledEnum.java @@ -49,8 +49,7 @@ public abstract class AbstractLabeledEnum implements LabeledEnum { return this.getCode().compareTo(that.getCode()); } - @Override - public boolean equals(Object obj) { + public boolean equals(Object obj) { if (this == obj) { return true; } @@ -61,13 +60,11 @@ public abstract class AbstractLabeledEnum implements LabeledEnum { return (this.getType().equals(other.getType()) && this.getCode().equals(other.getCode())); } - @Override - public int hashCode() { + public int hashCode() { return (getType().hashCode() * 29 + getCode().hashCode()); } - @Override - public String toString() { + public String toString() { return getLabel(); } diff --git a/org.springframework.core/src/main/java/org/springframework/core/enums/StaticLabeledEnumResolver.java b/org.springframework.core/src/main/java/org/springframework/core/enums/StaticLabeledEnumResolver.java index 7ce74cad7f8..a1ee63ef1a9 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/enums/StaticLabeledEnumResolver.java +++ b/org.springframework.core/src/main/java/org/springframework/core/enums/StaticLabeledEnumResolver.java @@ -16,13 +16,13 @@ package org.springframework.core.enums; -import org.springframework.util.Assert; - import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.util.Set; import java.util.TreeSet; +import org.springframework.util.Assert; + /** * {@link LabeledEnumResolver} that resolves statically defined enumerations. * Static implies all enum instances were defined within Java code, @@ -50,8 +50,7 @@ public class StaticLabeledEnumResolver extends AbstractCachingLabeledEnumResolve } - @Override - protected Set findLabeledEnums(Class type) { + protected Set findLabeledEnums(Class type) { Set typeEnums = new TreeSet(); Field[] fields = type.getFields(); for (int i = 0; i < fields.length; i++) { diff --git a/org.springframework.core/src/main/java/org/springframework/core/io/AbstractResource.java b/org.springframework.core/src/main/java/org/springframework/core/io/AbstractResource.java index 3a7063fabae..21fa7604d4b 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/io/AbstractResource.java +++ b/org.springframework.core/src/main/java/org/springframework/core/io/AbstractResource.java @@ -16,9 +16,6 @@ package org.springframework.core.io; -import org.springframework.core.NestedIOException; -import org.springframework.util.ResourceUtils; - import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; @@ -27,6 +24,9 @@ import java.net.URI; import java.net.URISyntaxException; import java.net.URL; +import org.springframework.core.NestedIOException; +import org.springframework.util.ResourceUtils; + /** * Convenience base class for {@link Resource} implementations, * pre-implementing typical behavior. @@ -153,8 +153,7 @@ public abstract class AbstractResource implements Resource { * This implementation returns the description of this resource. * @see #getDescription() */ - @Override - public String toString() { + public String toString() { return getDescription(); } @@ -162,8 +161,7 @@ public abstract class AbstractResource implements Resource { * This implementation compares description strings. * @see #getDescription() */ - @Override - public boolean equals(Object obj) { + public boolean equals(Object obj) { return (obj == this || (obj instanceof Resource && ((Resource) obj).getDescription().equals(getDescription()))); } @@ -172,8 +170,7 @@ public abstract class AbstractResource implements Resource { * This implementation returns the description's hash code. * @see #getDescription() */ - @Override - public int hashCode() { + public int hashCode() { return getDescription().hashCode(); } diff --git a/org.springframework.core/src/main/java/org/springframework/core/io/ByteArrayResource.java b/org.springframework.core/src/main/java/org/springframework/core/io/ByteArrayResource.java index 0811492edf1..48c5b81eabb 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/io/ByteArrayResource.java +++ b/org.springframework.core/src/main/java/org/springframework/core/io/ByteArrayResource.java @@ -75,8 +75,7 @@ public class ByteArrayResource extends AbstractResource { /** * This implementation always returns true. */ - @Override - public boolean exists() { + public boolean exists() { return true; } @@ -101,8 +100,7 @@ public class ByteArrayResource extends AbstractResource { * This implementation compares the underlying byte array. * @see java.util.Arrays#equals(byte[], byte[]) */ - @Override - public boolean equals(Object obj) { + public boolean equals(Object obj) { return (obj == this || (obj instanceof ByteArrayResource && Arrays.equals(((ByteArrayResource) obj).byteArray, this.byteArray))); } @@ -111,8 +109,7 @@ public class ByteArrayResource extends AbstractResource { * This implementation returns the hash code based on the * underlying byte array. */ - @Override - public int hashCode() { + public int hashCode() { return (byte[].class.hashCode() * 29 * this.byteArray.length); } diff --git a/org.springframework.core/src/main/java/org/springframework/core/io/ClassPathResource.java b/org.springframework.core/src/main/java/org/springframework/core/io/ClassPathResource.java index 53c78b1aba3..b803ad77ed2 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/io/ClassPathResource.java +++ b/org.springframework.core/src/main/java/org/springframework/core/io/ClassPathResource.java @@ -16,14 +16,18 @@ package org.springframework.core.io; -import org.springframework.util.*; - import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.net.URL; +import org.springframework.util.Assert; +import org.springframework.util.ClassUtils; +import org.springframework.util.ObjectUtils; +import org.springframework.util.ResourceUtils; +import org.springframework.util.StringUtils; + /** * {@link Resource} implementation for class path resources. * Uses either a given ClassLoader or a given Class for loading resources. @@ -147,8 +151,7 @@ public class ClassPathResource extends AbstractResource { * @see java.lang.ClassLoader#getResource(String) * @see java.lang.Class#getResource(String) */ - @Override - public URL getURL() throws IOException { + public URL getURL() throws IOException { URL url = null; if (this.clazz != null) { url = this.clazz.getResource(this.path); @@ -168,8 +171,7 @@ public class ClassPathResource extends AbstractResource { * resource, provided that it refers to a file in the file system. * @see org.springframework.util.ResourceUtils#getFile(java.net.URL, String) */ - @Override - public File getFile() throws IOException { + public File getFile() throws IOException { return ResourceUtils.getFile(getURL(), getDescription()); } @@ -177,8 +179,7 @@ public class ClassPathResource extends AbstractResource { * This implementation determines the underlying File * (or jar file, in case of a resource in a jar/zip). */ - @Override - protected File getFileForLastModifiedCheck() throws IOException { + protected File getFileForLastModifiedCheck() throws IOException { URL url = getURL(); if (ResourceUtils.isJarURL(url)) { URL actualUrl = ResourceUtils.extractJarFileURL(url); @@ -194,8 +195,7 @@ public class ClassPathResource extends AbstractResource { * relative to the path of the underlying resource of this descriptor. * @see org.springframework.util.StringUtils#applyRelativePath(String, String) */ - @Override - public Resource createRelative(String relativePath) { + public Resource createRelative(String relativePath) { String pathToUse = StringUtils.applyRelativePath(this.path, relativePath); return new ClassPathResource(pathToUse, this.classLoader, this.clazz); } @@ -205,8 +205,7 @@ public class ClassPathResource extends AbstractResource { * resource refers to. * @see org.springframework.util.StringUtils#getFilename(String) */ - @Override - public String getFilename() { + public String getFilename() { return StringUtils.getFilename(this.path); } @@ -221,8 +220,7 @@ public class ClassPathResource extends AbstractResource { /** * This implementation compares the underlying class path locations. */ - @Override - public boolean equals(Object obj) { + public boolean equals(Object obj) { if (obj == this) { return true; } @@ -239,8 +237,7 @@ public class ClassPathResource extends AbstractResource { * This implementation returns the hash code of the underlying * class path location. */ - @Override - public int hashCode() { + public int hashCode() { return this.path.hashCode(); } diff --git a/org.springframework.core/src/main/java/org/springframework/core/io/DefaultResourceLoader.java b/org.springframework.core/src/main/java/org/springframework/core/io/DefaultResourceLoader.java index 325d6254452..6baf59498f1 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/io/DefaultResourceLoader.java +++ b/org.springframework.core/src/main/java/org/springframework/core/io/DefaultResourceLoader.java @@ -16,13 +16,13 @@ package org.springframework.core.io; +import java.net.MalformedURLException; +import java.net.URL; + import org.springframework.util.Assert; import org.springframework.util.ClassUtils; import org.springframework.util.StringUtils; -import java.net.MalformedURLException; -import java.net.URL; - /** * Default implementation of the {@link ResourceLoader} interface. * Used by {@link ResourceEditor}, and serves as base class for @@ -134,8 +134,7 @@ public class DefaultResourceLoader implements ResourceLoader { return getPath(); } - @Override - public Resource createRelative(String relativePath) { + public Resource createRelative(String relativePath) { String pathToUse = StringUtils.applyRelativePath(getPath(), relativePath); return new ClassPathContextResource(pathToUse, getClassLoader()); } diff --git a/org.springframework.core/src/main/java/org/springframework/core/io/DescriptiveResource.java b/org.springframework.core/src/main/java/org/springframework/core/io/DescriptiveResource.java index aaa51cb13d2..cab0c6a5d78 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/io/DescriptiveResource.java +++ b/org.springframework.core/src/main/java/org/springframework/core/io/DescriptiveResource.java @@ -44,13 +44,11 @@ public class DescriptiveResource extends AbstractResource { } - @Override - public boolean exists() { + public boolean exists() { return false; } - @Override - public boolean isReadable() { + public boolean isReadable() { return false; } @@ -67,8 +65,7 @@ public class DescriptiveResource extends AbstractResource { /** * This implementation compares the underlying description String. */ - @Override - public boolean equals(Object obj) { + public boolean equals(Object obj) { return (obj == this || (obj instanceof DescriptiveResource && ((DescriptiveResource) obj).description.equals(this.description))); } @@ -76,8 +73,7 @@ public class DescriptiveResource extends AbstractResource { /** * This implementation returns the hash code of the underlying description String. */ - @Override - public int hashCode() { + public int hashCode() { return this.description.hashCode(); } diff --git a/org.springframework.core/src/main/java/org/springframework/core/io/FileSystemResource.java b/org.springframework.core/src/main/java/org/springframework/core/io/FileSystemResource.java index 17e591706f0..ef063870348 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/io/FileSystemResource.java +++ b/org.springframework.core/src/main/java/org/springframework/core/io/FileSystemResource.java @@ -16,9 +16,6 @@ package org.springframework.core.io; -import org.springframework.util.Assert; -import org.springframework.util.StringUtils; - import java.io.File; import java.io.FileInputStream; import java.io.IOException; @@ -26,6 +23,9 @@ import java.io.InputStream; import java.net.URI; import java.net.URL; +import org.springframework.util.Assert; +import org.springframework.util.StringUtils; + /** * {@link Resource} implementation for java.io.File handles. * Obviously supports resolution as File, and also as URL. @@ -86,8 +86,7 @@ public class FileSystemResource extends AbstractResource { * This implementation returns whether the underlying file exists. * @see java.io.File#exists() */ - @Override - public boolean exists() { + public boolean exists() { return this.file.exists(); } @@ -97,8 +96,7 @@ public class FileSystemResource extends AbstractResource { * @see java.io.File#canRead() * @see java.io.File#isDirectory() */ - @Override - public boolean isReadable() { + public boolean isReadable() { return (this.file.canRead() && !this.file.isDirectory()); } @@ -114,8 +112,7 @@ public class FileSystemResource extends AbstractResource { * This implementation returns a URL for the underlying file. * @see java.io.File#toURI() */ - @Override - public URL getURL() throws IOException { + public URL getURL() throws IOException { return this.file.toURI().toURL(); } @@ -123,16 +120,14 @@ public class FileSystemResource extends AbstractResource { * This implementation returns a URI for the underlying file. * @see java.io.File#toURI() */ - @Override - public URI getURI() throws IOException { + public URI getURI() throws IOException { return this.file.toURI(); } /** * This implementation returns the underlying File reference. */ - @Override - public File getFile() { + public File getFile() { return this.file; } @@ -141,8 +136,7 @@ public class FileSystemResource extends AbstractResource { * relative to the path of the underlying file of this resource descriptor. * @see org.springframework.util.StringUtils#applyRelativePath(String, String) */ - @Override - public Resource createRelative(String relativePath) { + public Resource createRelative(String relativePath) { String pathToUse = StringUtils.applyRelativePath(this.path, relativePath); return new FileSystemResource(pathToUse); } @@ -151,8 +145,7 @@ public class FileSystemResource extends AbstractResource { * This implementation returns the name of the file. * @see java.io.File#getName() */ - @Override - public String getFilename() { + public String getFilename() { return this.file.getName(); } @@ -169,8 +162,7 @@ public class FileSystemResource extends AbstractResource { /** * This implementation compares the underlying File references. */ - @Override - public boolean equals(Object obj) { + public boolean equals(Object obj) { return (obj == this || (obj instanceof FileSystemResource && this.path.equals(((FileSystemResource) obj).path))); } @@ -178,8 +170,7 @@ public class FileSystemResource extends AbstractResource { /** * This implementation returns the hash code of the underlying File reference. */ - @Override - public int hashCode() { + public int hashCode() { return this.path.hashCode(); } diff --git a/org.springframework.core/src/main/java/org/springframework/core/io/FileSystemResourceLoader.java b/org.springframework.core/src/main/java/org/springframework/core/io/FileSystemResourceLoader.java index fe7ae47f878..30891d18966 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/io/FileSystemResourceLoader.java +++ b/org.springframework.core/src/main/java/org/springframework/core/io/FileSystemResourceLoader.java @@ -46,8 +46,7 @@ public class FileSystemResourceLoader extends DefaultResourceLoader { * @see FileSystemResource * @see org.springframework.web.context.support.ServletContextResourceLoader#getResourceByPath */ - @Override - protected Resource getResourceByPath(String path) { + protected Resource getResourceByPath(String path) { if (path != null && path.startsWith("/")) { path = path.substring(1); } diff --git a/org.springframework.core/src/main/java/org/springframework/core/io/InputStreamResource.java b/org.springframework.core/src/main/java/org/springframework/core/io/InputStreamResource.java index 67442581f7e..e42edef6acf 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/io/InputStreamResource.java +++ b/org.springframework.core/src/main/java/org/springframework/core/io/InputStreamResource.java @@ -71,16 +71,14 @@ public class InputStreamResource extends AbstractResource { /** * This implementation always returns true. */ - @Override - public boolean exists() { + public boolean exists() { return true; } /** * This implementation always returns true. */ - @Override - public boolean isOpen() { + public boolean isOpen() { return true; } @@ -108,8 +106,7 @@ public class InputStreamResource extends AbstractResource { /** * This implementation compares the underlying InputStream. */ - @Override - public boolean equals(Object obj) { + public boolean equals(Object obj) { return (obj == this || (obj instanceof InputStreamResource && ((InputStreamResource) obj).inputStream.equals(this.inputStream))); } @@ -117,8 +114,7 @@ public class InputStreamResource extends AbstractResource { /** * This implementation returns the hash code of the underlying InputStream. */ - @Override - public int hashCode() { + public int hashCode() { return this.inputStream.hashCode(); } diff --git a/org.springframework.core/src/main/java/org/springframework/core/io/ResourceEditor.java b/org.springframework.core/src/main/java/org/springframework/core/io/ResourceEditor.java index 897419171bc..9d53130c02a 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/io/ResourceEditor.java +++ b/org.springframework.core/src/main/java/org/springframework/core/io/ResourceEditor.java @@ -16,13 +16,13 @@ package org.springframework.core.io; +import java.beans.PropertyEditorSupport; +import java.io.IOException; + import org.springframework.util.Assert; import org.springframework.util.StringUtils; import org.springframework.util.SystemPropertyUtils; -import java.beans.PropertyEditorSupport; -import java.io.IOException; - /** * {@link java.beans.PropertyEditor Editor} for {@link Resource} * descriptors, to automatically convert String locations @@ -68,8 +68,7 @@ public class ResourceEditor extends PropertyEditorSupport { } - @Override - public void setAsText(String text) { + public void setAsText(String text) { if (StringUtils.hasText(text)) { String locationToUse = resolvePath(text).trim(); setValue(this.resourceLoader.getResource(locationToUse)); @@ -91,8 +90,7 @@ public class ResourceEditor extends PropertyEditorSupport { } - @Override - public String getAsText() { + public String getAsText() { Resource value = (Resource) getValue(); try { // Try to determine URL for resource. diff --git a/org.springframework.core/src/main/java/org/springframework/core/io/UrlResource.java b/org.springframework.core/src/main/java/org/springframework/core/io/UrlResource.java index ff48b88f4d6..0627cb09ddf 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/io/UrlResource.java +++ b/org.springframework.core/src/main/java/org/springframework/core/io/UrlResource.java @@ -16,10 +16,6 @@ package org.springframework.core.io; -import org.springframework.util.Assert; -import org.springframework.util.ResourceUtils; -import org.springframework.util.StringUtils; - import java.io.File; import java.io.IOException; import java.io.InputStream; @@ -28,6 +24,10 @@ import java.net.URI; import java.net.URL; import java.net.URLConnection; +import org.springframework.util.Assert; +import org.springframework.util.ResourceUtils; +import org.springframework.util.StringUtils; + /** * {@link Resource} implementation for java.net.URL locators. * Obviously supports resolution as URL, and also as File in case of @@ -126,8 +126,7 @@ public class UrlResource extends AbstractResource { /** * This implementation returns the underlying URL reference. */ - @Override - public URL getURL() throws IOException { + public URL getURL() throws IOException { return this.url; } @@ -135,8 +134,7 @@ public class UrlResource extends AbstractResource { * This implementation returns the underlying URI directly, * if possible. */ - @Override - public URI getURI() throws IOException { + public URI getURI() throws IOException { if (this.uri != null) { return this.uri; } @@ -150,8 +148,7 @@ public class UrlResource extends AbstractResource { * provided that it refers to a file in the file system. * @see org.springframework.util.ResourceUtils#getFile(java.net.URL, String) */ - @Override - public File getFile() throws IOException { + public File getFile() throws IOException { if (this.uri != null) { return ResourceUtils.getFile(this.uri, getDescription()); } @@ -164,8 +161,7 @@ public class UrlResource extends AbstractResource { * This implementation determines the underlying File * (or jar file, in case of a resource in a jar/zip). */ - @Override - protected File getFileForLastModifiedCheck() throws IOException { + protected File getFileForLastModifiedCheck() throws IOException { if (ResourceUtils.isJarURL(this.url)) { URL actualUrl = ResourceUtils.extractJarFileURL(this.url); return ResourceUtils.getFile(actualUrl); @@ -180,8 +176,7 @@ public class UrlResource extends AbstractResource { * relative to the path of the underlying URL of this resource descriptor. * @see java.net.URL#URL(java.net.URL, String) */ - @Override - public Resource createRelative(String relativePath) throws MalformedURLException { + public Resource createRelative(String relativePath) throws MalformedURLException { if (relativePath.startsWith("/")) { relativePath = relativePath.substring(1); } @@ -193,8 +188,7 @@ public class UrlResource extends AbstractResource { * @see java.net.URL#getFile() * @see java.io.File#getName() */ - @Override - public String getFilename() { + public String getFilename() { return new File(this.url.getFile()).getName(); } @@ -209,8 +203,7 @@ public class UrlResource extends AbstractResource { /** * This implementation compares the underlying URL references. */ - @Override - public boolean equals(Object obj) { + public boolean equals(Object obj) { return (obj == this || (obj instanceof UrlResource && this.cleanedUrl.equals(((UrlResource) obj).cleanedUrl))); } @@ -218,8 +211,7 @@ public class UrlResource extends AbstractResource { /** * This implementation returns the hash code of the underlying URL reference. */ - @Override - public int hashCode() { + public int hashCode() { return this.cleanedUrl.hashCode(); } diff --git a/org.springframework.core/src/main/java/org/springframework/core/io/support/EncodedResource.java b/org.springframework.core/src/main/java/org/springframework/core/io/support/EncodedResource.java index 66882ccfa11..4e680d1193f 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/io/support/EncodedResource.java +++ b/org.springframework.core/src/main/java/org/springframework/core/io/support/EncodedResource.java @@ -16,14 +16,14 @@ package org.springframework.core.io.support; -import org.springframework.core.io.Resource; -import org.springframework.util.Assert; -import org.springframework.util.ObjectUtils; - import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; +import org.springframework.core.io.Resource; +import org.springframework.util.Assert; +import org.springframework.util.ObjectUtils; + /** * Holder that combines a {@link org.springframework.core.io.Resource} * with a specific encoding to be used for reading from the resource. @@ -94,8 +94,7 @@ public class EncodedResource { } - @Override - public boolean equals(Object obj) { + public boolean equals(Object obj) { if (obj == this) { return true; } @@ -107,13 +106,11 @@ public class EncodedResource { return false; } - @Override - public int hashCode() { + public int hashCode() { return this.resource.hashCode(); } - @Override - public String toString() { + public String toString() { return this.resource.toString(); } diff --git a/org.springframework.core/src/main/java/org/springframework/core/io/support/ResourceArrayPropertyEditor.java b/org.springframework.core/src/main/java/org/springframework/core/io/support/ResourceArrayPropertyEditor.java index 4973bad7f55..ac4b2c5596c 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/io/support/ResourceArrayPropertyEditor.java +++ b/org.springframework.core/src/main/java/org/springframework/core/io/support/ResourceArrayPropertyEditor.java @@ -16,12 +16,16 @@ package org.springframework.core.io.support; -import org.springframework.core.io.Resource; -import org.springframework.util.SystemPropertyUtils; - import java.beans.PropertyEditorSupport; import java.io.IOException; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; + +import org.springframework.core.io.Resource; +import org.springframework.util.SystemPropertyUtils; /** * Editor for {@link org.springframework.core.io.Resource} arrays, to @@ -70,8 +74,7 @@ public class ResourceArrayPropertyEditor extends PropertyEditorSupport { /** * Treat the given text as location pattern and convert it to a Resource array. */ - @Override - public void setAsText(String text) { + public void setAsText(String text) { String pattern = resolvePath(text).trim(); try { setValue(this.resourcePatternResolver.getResources(pattern)); @@ -86,8 +89,7 @@ public class ResourceArrayPropertyEditor extends PropertyEditorSupport { * Treat the given value as collection or array and convert it to a Resource array. * Considers String elements as location patterns, and takes Resource elements as-is. */ - @Override - public void setValue(Object value) throws IllegalArgumentException { + public void setValue(Object value) throws IllegalArgumentException { if (value instanceof Collection || (value instanceof Object[] && !(value instanceof Resource[]))) { Collection input = (value instanceof Collection ? (Collection) value : Arrays.asList((Object[]) value)); List merged = new ArrayList(); diff --git a/org.springframework.core/src/main/java/org/springframework/core/style/ToStringCreator.java b/org.springframework.core/src/main/java/org/springframework/core/style/ToStringCreator.java index 298b345d993..8d78888258e 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/style/ToStringCreator.java +++ b/org.springframework.core/src/main/java/org/springframework/core/style/ToStringCreator.java @@ -180,8 +180,7 @@ public class ToStringCreator { /** * Return the String representation that this ToStringCreator built. */ - @Override - public String toString() { + public String toString() { this.styler.styleEnd(this.buffer, this.object); return this.buffer.toString(); } diff --git a/org.springframework.core/src/main/java/org/springframework/core/task/SimpleAsyncTaskExecutor.java b/org.springframework.core/src/main/java/org/springframework/core/task/SimpleAsyncTaskExecutor.java index 79bafbd70ee..2ac8c1289d0 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/task/SimpleAsyncTaskExecutor.java +++ b/org.springframework.core/src/main/java/org/springframework/core/task/SimpleAsyncTaskExecutor.java @@ -16,13 +16,13 @@ package org.springframework.core.task; +import java.io.Serializable; + import org.springframework.util.Assert; import org.springframework.util.ClassUtils; import org.springframework.util.ConcurrencyThrottleSupport; import org.springframework.util.CustomizableThreadCreator; -import java.io.Serializable; - /** * TaskExecutor implementation that fires up a new Thread for each task, * executing it asynchronously. @@ -166,13 +166,11 @@ public class SimpleAsyncTaskExecutor extends CustomizableThreadCreator implement */ private static class ConcurrencyThrottleAdapter extends ConcurrencyThrottleSupport { - @Override - protected void beforeAccess() { + protected void beforeAccess() { super.beforeAccess(); } - @Override - protected void afterAccess() { + protected void afterAccess() { super.afterAccess(); } } diff --git a/org.springframework.core/src/main/java/org/springframework/core/type/classreading/AnnotationMetadataReadingVisitor.java b/org.springframework.core/src/main/java/org/springframework/core/type/classreading/AnnotationMetadataReadingVisitor.java index 1bff7a7d7a0..9236bf38fa9 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/type/classreading/AnnotationMetadataReadingVisitor.java +++ b/org.springframework.core/src/main/java/org/springframework/core/type/classreading/AnnotationMetadataReadingVisitor.java @@ -16,14 +16,19 @@ package org.springframework.core.type.classreading; +import java.lang.annotation.Annotation; +import java.lang.reflect.Method; +import java.util.Collection; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Set; + import org.objectweb.asm.AnnotationVisitor; import org.objectweb.asm.Type; import org.objectweb.asm.commons.EmptyVisitor; -import org.springframework.core.type.AnnotationMetadata; -import java.lang.annotation.Annotation; -import java.lang.reflect.Method; -import java.util.*; +import org.springframework.core.type.AnnotationMetadata; /** * ASM class visitor which looks for the class name and implemented types as @@ -49,18 +54,15 @@ class AnnotationMetadataReadingVisitor extends ClassMetadataReadingVisitor imple } - @Override - public AnnotationVisitor visitAnnotation(final String desc, boolean visible) { + public AnnotationVisitor visitAnnotation(final String desc, boolean visible) { final String className = Type.getType(desc).getClassName(); final Map attributes = new LinkedHashMap(); return new EmptyVisitor() { - @Override - public void visit(String name, Object value) { + public void visit(String name, Object value) { // Explicitly defined annotation attribute value. attributes.put(name, value); } - @Override - public void visitEnd() { + public void visitEnd() { try { Class annotationClass = classLoader.loadClass(className); // Check declared default values of attributes in the annotation type. diff --git a/org.springframework.core/src/main/java/org/springframework/core/type/classreading/CachingMetadataReaderFactory.java b/org.springframework.core/src/main/java/org/springframework/core/type/classreading/CachingMetadataReaderFactory.java index bdc9eec048c..ea1843966ac 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/type/classreading/CachingMetadataReaderFactory.java +++ b/org.springframework.core/src/main/java/org/springframework/core/type/classreading/CachingMetadataReaderFactory.java @@ -16,13 +16,13 @@ package org.springframework.core.type.classreading; -import org.springframework.core.io.Resource; -import org.springframework.core.io.ResourceLoader; - import java.io.IOException; import java.util.HashMap; import java.util.Map; +import org.springframework.core.io.Resource; +import org.springframework.core.io.ResourceLoader; + /** * Caching implementation of the {@link MetadataReaderFactory} interface, * caching an ASM {@link org.objectweb.asm.ClassReader} per Spring Resource handle @@ -61,8 +61,7 @@ public class CachingMetadataReaderFactory extends SimpleMetadataReaderFactory { } - @Override - public MetadataReader getMetadataReader(Resource resource) throws IOException { + public MetadataReader getMetadataReader(Resource resource) throws IOException { synchronized (this.classReaderCache) { MetadataReader metadataReader = this.classReaderCache.get(resource); if (metadataReader == null) { diff --git a/org.springframework.core/src/main/java/org/springframework/core/type/classreading/ClassMetadataReadingVisitor.java b/org.springframework.core/src/main/java/org/springframework/core/type/classreading/ClassMetadataReadingVisitor.java index 836c2c5a1e9..892bc6a0d8b 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/type/classreading/ClassMetadataReadingVisitor.java +++ b/org.springframework.core/src/main/java/org/springframework/core/type/classreading/ClassMetadataReadingVisitor.java @@ -18,6 +18,7 @@ package org.springframework.core.type.classreading; import org.objectweb.asm.Opcodes; import org.objectweb.asm.commons.EmptyVisitor; + import org.springframework.core.type.ClassMetadata; import org.springframework.util.ClassUtils; @@ -49,8 +50,7 @@ class ClassMetadataReadingVisitor extends EmptyVisitor implements ClassMetadata private String[] interfaces; - @Override - public void visit(int version, int access, String name, String signature, String supername, String[] interfaces) { + public void visit(int version, int access, String name, String signature, String supername, String[] interfaces) { this.className = ClassUtils.convertResourcePathToClassName(name); this.isInterface = ((access & Opcodes.ACC_INTERFACE) != 0); this.isAbstract = ((access & Opcodes.ACC_ABSTRACT) != 0); @@ -63,13 +63,11 @@ class ClassMetadataReadingVisitor extends EmptyVisitor implements ClassMetadata } } - @Override - public void visitOuterClass(String owner, String name, String desc) { + public void visitOuterClass(String owner, String name, String desc) { this.enclosingClassName = ClassUtils.convertResourcePathToClassName(owner); } - @Override - public void visitInnerClass(String name, String outerName, String innerName, int access) { + public void visitInnerClass(String name, String outerName, String innerName, int access) { if (outerName != null && this.className.equals(ClassUtils.convertResourcePathToClassName(name))) { this.enclosingClassName = ClassUtils.convertResourcePathToClassName(outerName); this.independentInnerClass = ((access & Opcodes.ACC_STATIC) != 0); diff --git a/org.springframework.core/src/main/java/org/springframework/util/AutoPopulatingList.java b/org.springframework.core/src/main/java/org/springframework/util/AutoPopulatingList.java index 4458b24bd4d..e7276f8c900 100644 --- a/org.springframework.core/src/main/java/org/springframework/util/AutoPopulatingList.java +++ b/org.springframework.core/src/main/java/org/springframework/util/AutoPopulatingList.java @@ -18,7 +18,11 @@ package org.springframework.util; import java.io.Serializable; import java.lang.reflect.Modifier; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.ListIterator; /** * Simple {@link List} wrapper class that allows for elements to be @@ -115,8 +119,7 @@ public class AutoPopulatingList implements List, Serializable { return this.backingList.containsAll(c); } - @Override - public boolean equals(Object o) { + public boolean equals(Object o) { return this.backingList.equals(o); } @@ -145,8 +148,7 @@ public class AutoPopulatingList implements List, Serializable { return element; } - @Override - public int hashCode() { + public int hashCode() { return this.backingList.hashCode(); } diff --git a/org.springframework.core/src/main/java/org/springframework/util/CachingMapDecorator.java b/org.springframework.core/src/main/java/org/springframework/util/CachingMapDecorator.java index 5d36e91f449..c6f87c57a8d 100644 --- a/org.springframework.core/src/main/java/org/springframework/util/CachingMapDecorator.java +++ b/org.springframework.core/src/main/java/org/springframework/util/CachingMapDecorator.java @@ -19,7 +19,15 @@ package org.springframework.util; import java.io.Serializable; import java.lang.ref.Reference; import java.lang.ref.WeakReference; -import java.util.*; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedHashSet; +import java.util.LinkedList; +import java.util.Map; +import java.util.Set; +import java.util.WeakHashMap; /** * A simple decorator for a Map, encapsulating the workflow for caching @@ -261,8 +269,7 @@ public class CachingMapDecorator implements Map, Serializable { } - @Override - public String toString() { + public String toString() { return "CachingMapDecorator [" + getClass().getName() + "]:" + this.targetMap; } diff --git a/org.springframework.core/src/main/java/org/springframework/util/CommonsLogWriter.java b/org.springframework.core/src/main/java/org/springframework/util/CommonsLogWriter.java index 52a9629069b..9db1c876601 100644 --- a/org.springframework.core/src/main/java/org/springframework/util/CommonsLogWriter.java +++ b/org.springframework.core/src/main/java/org/springframework/util/CommonsLogWriter.java @@ -16,10 +16,10 @@ package org.springframework.util; -import org.apache.commons.logging.Log; - import java.io.Writer; +import org.apache.commons.logging.Log; + /** * java.io.Writer adapter for a Commons Logging Log. * @@ -53,8 +53,7 @@ public class CommonsLogWriter extends Writer { } } - @Override - public void write(char[] buffer, int offset, int length) { + public void write(char[] buffer, int offset, int length) { for (int i = 0; i < length; i++) { char ch = buffer[offset + i]; if (ch == '\n' && this.buffer.length() > 0) { @@ -67,12 +66,10 @@ public class CommonsLogWriter extends Writer { } } - @Override - public void flush() { + public void flush() { } - @Override - public void close() { + public void close() { } } diff --git a/org.springframework.core/src/main/java/org/springframework/util/StopWatch.java b/org.springframework.core/src/main/java/org/springframework/util/StopWatch.java index ca4ad99deb9..7fc0c9ab74c 100644 --- a/org.springframework.core/src/main/java/org/springframework/util/StopWatch.java +++ b/org.springframework.core/src/main/java/org/springframework/util/StopWatch.java @@ -232,8 +232,7 @@ public class StopWatch { * Return an informative string describing all tasks performed * For custom reporting, call getTaskInfo() and use the task info directly. */ - @Override - public String toString() { + public String toString() { StringBuffer sb = new StringBuffer(shortSummary()); if (this.keepTaskList) { TaskInfo[] tasks = getTaskInfo(); diff --git a/org.springframework.core/src/main/java/org/springframework/util/comparator/BooleanComparator.java b/org.springframework.core/src/main/java/org/springframework/util/comparator/BooleanComparator.java index 9eea9c83515..4095b2f3c8c 100644 --- a/org.springframework.core/src/main/java/org/springframework/util/comparator/BooleanComparator.java +++ b/org.springframework.core/src/main/java/org/springframework/util/comparator/BooleanComparator.java @@ -64,8 +64,7 @@ public final class BooleanComparator implements Comparator, Serializable { return (v1 ^ v2) ? ((v1 ^ this.trueLow) ? 1 : -1) : 0; } - @Override - public boolean equals(Object obj) { + public boolean equals(Object obj) { if (this == obj) { return true; } @@ -75,13 +74,11 @@ public final class BooleanComparator implements Comparator, Serializable { return (this.trueLow == ((BooleanComparator) obj).trueLow); } - @Override - public int hashCode() { + public int hashCode() { return (this.trueLow ? -1 : 1) * getClass().hashCode(); } - @Override - public String toString() { + public String toString() { return "BooleanComparator: " + (this.trueLow ? "true low" : "true high"); } diff --git a/org.springframework.core/src/main/java/org/springframework/util/comparator/CompoundComparator.java b/org.springframework.core/src/main/java/org/springframework/util/comparator/CompoundComparator.java index 2ca34b7347f..3de42f56ab0 100644 --- a/org.springframework.core/src/main/java/org/springframework/util/comparator/CompoundComparator.java +++ b/org.springframework.core/src/main/java/org/springframework/util/comparator/CompoundComparator.java @@ -16,14 +16,14 @@ package org.springframework.util.comparator; -import org.springframework.util.Assert; - import java.io.Serializable; import java.util.ArrayList; import java.util.Comparator; import java.util.Iterator; import java.util.List; +import org.springframework.util.Assert; + /** * A comparator that chains a sequence of one or more more Comparators. * @@ -184,8 +184,7 @@ public class CompoundComparator implements Comparator, Serializable { return 0; } - @Override - public boolean equals(Object obj) { + public boolean equals(Object obj) { if (this == obj) { return true; } @@ -196,13 +195,11 @@ public class CompoundComparator implements Comparator, Serializable { return this.comparators.equals(other.comparators); } - @Override - public int hashCode() { + public int hashCode() { return this.comparators.hashCode(); } - @Override - public String toString() { + public String toString() { return "CompoundComparator: " + this.comparators; } diff --git a/org.springframework.core/src/main/java/org/springframework/util/comparator/InvertibleComparator.java b/org.springframework.core/src/main/java/org/springframework/util/comparator/InvertibleComparator.java index 5328ca9b167..22f73f771b3 100644 --- a/org.springframework.core/src/main/java/org/springframework/util/comparator/InvertibleComparator.java +++ b/org.springframework.core/src/main/java/org/springframework/util/comparator/InvertibleComparator.java @@ -96,8 +96,7 @@ public class InvertibleComparator implements Comparator, Serializable { return 0; } - @Override - public boolean equals(Object obj) { + public boolean equals(Object obj) { if (this == obj) { return true; } @@ -108,13 +107,11 @@ public class InvertibleComparator implements Comparator, Serializable { return (this.comparator.equals(other.comparator) && this.ascending == other.ascending); } - @Override - public int hashCode() { + public int hashCode() { return this.comparator.hashCode(); } - @Override - public String toString() { + public String toString() { return "InvertibleComparator: [" + this.comparator + "]; ascending=" + this.ascending; } diff --git a/org.springframework.core/src/main/java/org/springframework/util/comparator/NullSafeComparator.java b/org.springframework.core/src/main/java/org/springframework/util/comparator/NullSafeComparator.java index c8e433d136d..edec70ff4a9 100644 --- a/org.springframework.core/src/main/java/org/springframework/util/comparator/NullSafeComparator.java +++ b/org.springframework.core/src/main/java/org/springframework/util/comparator/NullSafeComparator.java @@ -16,10 +16,10 @@ package org.springframework.util.comparator; -import org.springframework.util.Assert; - import java.util.Comparator; +import org.springframework.util.Assert; + /** * A Comparator that will safely compare nulls to be lower or higher than * other objects. Can decorate a given Comparator or work on Comparables. @@ -96,8 +96,7 @@ public class NullSafeComparator implements Comparator { return this.nonNullComparator.compare(o1, o2); } - @Override - public boolean equals(Object obj) { + public boolean equals(Object obj) { if (this == obj) { return true; } @@ -108,13 +107,11 @@ public class NullSafeComparator implements Comparator { return (this.nonNullComparator.equals(other.nonNullComparator) && this.nullsLow == other.nullsLow); } - @Override - public int hashCode() { + public int hashCode() { return (this.nullsLow ? -1 : 1) * this.nonNullComparator.hashCode(); } - @Override - public String toString() { + public String toString() { return "NullSafeComparator: non-null comparator [" + this.nonNullComparator + "]; " + (this.nullsLow ? "nulls low" : "nulls high"); }