From 69587f3fa4ac92fb00f243d998240a18f13111ff Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Thu, 14 Aug 2014 23:49:29 +0200 Subject: [PATCH] Polishing --- .../beans/factory/support/MethodOverride.java | 2 ++ .../factory/xml/XmlBeanFactoryTestTypes.java | 25 ------------------- .../springframework/util/ReflectionUtils.java | 10 +++----- 3 files changed, 6 insertions(+), 31 deletions(-) diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/MethodOverride.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/MethodOverride.java index 75bb2e2194..bf11af7eb5 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/MethodOverride.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/MethodOverride.java @@ -52,6 +52,7 @@ public abstract class MethodOverride implements BeanMetadataElement { this.methodName = methodName; } + /** * Return the name of the method to be overridden. */ @@ -99,6 +100,7 @@ public abstract class MethodOverride implements BeanMetadataElement { */ public abstract boolean matches(Method method); + @Override public boolean equals(Object other) { if (this == other) { diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTestTypes.java b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTestTypes.java index a5bc212ced..bb9245d02c 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTestTypes.java +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTestTypes.java @@ -174,7 +174,6 @@ abstract class ConstructorInjectedOverrides { return this.tb; } - protected abstract FactoryMethods createFactoryMethods(); /** @@ -229,7 +228,6 @@ class DerivedConstructorDependenciesBean extends ConstructorDependenciesBean { private void destroy() { this.destroyed = true; } - } @@ -240,7 +238,6 @@ class DerivedConstructorDependenciesBean extends ConstructorDependenciesBean { interface DummyBo { void something(); - } @@ -258,9 +255,7 @@ class DummyBoImpl implements DummyBo { @Override public void something() { - } - } @@ -274,7 +269,6 @@ class DummyDao { public DummyDao(DataSource ds) { this.ds = ds; } - } @@ -290,7 +284,6 @@ class DummyReferencer { private DummyFactory dummyFactory; - public DummyReferencer() { } @@ -321,7 +314,6 @@ class DummyReferencer { public TestBean getTestBean2() { return testBean2; } - } @@ -370,13 +362,11 @@ class FactoryMethods { return Collections.EMPTY_LIST; } - private int num = 0; private String name = "default"; private TestBean tb; private String stringValue; - /** * Constructor is private: not for use outside this class, * even by IoC container. @@ -421,7 +411,6 @@ class FactoryMethods { public void setName(String name) { this.name = name; } - } /** @@ -436,7 +425,6 @@ class FixedMethodReplacer implements MethodReplacer { public Object reimplement(Object obj, Method method, Object[] args) throws Throwable { return VALUE; } - } @@ -469,22 +457,17 @@ class MethodReplaceCandidate { public String replaceMe(String echo) { return echo; } - } /** * Bean that exposes a simple property that can be set * to a mix of references and individual values. - * - * @author Rod Johnson - * @since 27.05.2003 */ class MixedCollectionBean { private Collection jumble; - public void setJumble(Collection jumble) { this.jumble = jumble; } @@ -492,7 +475,6 @@ class MixedCollectionBean { public Collection getJumble() { return jumble; } - } @@ -504,7 +486,6 @@ interface OverrideInterface { TestBean getPrototypeDependency(); TestBean getPrototypeDependency(Object someParam); - } @@ -563,7 +544,6 @@ abstract class OverrideOneMethodSubclass extends OverrideOneMethod { // This implementation does nothing! // It's not overloaded } - } @@ -591,7 +571,6 @@ class ProtectedLifecycleBean implements BeanNameAware, BeanFactoryAware, Initial protected boolean destroyed; - public void setInitMethodDeclared(boolean initMethodDeclared) { this.initMethodDeclared = initMethodDeclared; } @@ -707,7 +686,6 @@ class ProtectedLifecycleBean implements BeanNameAware, BeanFactoryAware, Initial return bean; } } - } @@ -722,7 +700,6 @@ class ReverseMethodReplacer implements MethodReplacer, Serializable { String s = (String) args[0]; return new StringBuffer(s).reverse().toString(); } - } @@ -733,7 +710,6 @@ class ReverseMethodReplacer implements MethodReplacer, Serializable { abstract class SerializableMethodReplacerCandidate extends MethodReplaceCandidate implements Serializable { //public abstract Point getPoint(); - } @@ -769,5 +745,4 @@ class SingleSimpleTypeConstructorBean { public String getTestString() { return testString; } - } diff --git a/spring-core/src/main/java/org/springframework/util/ReflectionUtils.java b/spring-core/src/main/java/org/springframework/util/ReflectionUtils.java index 1bf528e9d2..87b7c6641a 100644 --- a/spring-core/src/main/java/org/springframework/util/ReflectionUtils.java +++ b/spring-core/src/main/java/org/springframework/util/ReflectionUtils.java @@ -495,8 +495,7 @@ public abstract class ReflectionUtils { mc.doWith(method); } catch (IllegalAccessException ex) { - throw new IllegalStateException("Shouldn't be illegal to access method '" + method.getName() - + "': " + ex); + throw new IllegalStateException("Shouldn't be illegal to access method '" + method.getName() + "': " + ex); } } if (clazz.getSuperclass() != null) { @@ -607,8 +606,7 @@ public abstract class ReflectionUtils { fc.doWith(field); } catch (IllegalAccessException ex) { - throw new IllegalStateException( - "Shouldn't be illegal to access field '" + field.getName() + "': " + ex); + throw new IllegalStateException("Shouldn't be illegal to access field '" + field.getName() + "': " + ex); } } targetClass = targetClass.getSuperclass(); @@ -630,8 +628,8 @@ public abstract class ReflectionUtils { throw new IllegalArgumentException("Destination for field copy cannot be null"); } if (!src.getClass().isAssignableFrom(dest.getClass())) { - throw new IllegalArgumentException("Destination class [" + dest.getClass().getName() - + "] must be same or subclass as source class [" + src.getClass().getName() + "]"); + throw new IllegalArgumentException("Destination class [" + dest.getClass().getName() + + "] must be same or subclass as source class [" + src.getClass().getName() + "]"); } doWithFields(src.getClass(), new FieldCallback() { @Override