From d67fe1db8693eae899175caf2f936241c3cacf0f Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Mon, 11 Nov 2013 12:09:50 +0100 Subject: [PATCH] Polish spring-context - Cache interceptor internals now operate on collections of instead of . - Deleted unused imports. - Deleted dead code. - Suppressed warnings for resource leaks related to not closing ApplicationContexts in tests. - Suppressed further non-issue warnings in tests. --- .../cache/interceptor/CacheAspectSupport.java | 7 +++--- .../CacheExpressionRootObject.java | 11 +++++----- .../interceptor/ExpressionEvaluator.java | 7 +++--- .../CommonAnnotationBeanPostProcessor.java | 3 --- .../annotation/ConditionEvaluator.java | 1 - .../weaving/DefaultContextLoadTimeWeaver.java | 1 - .../support/MethodInvokingRunnable.java | 2 +- .../groovy/GroovyScriptEvaluator.java | 1 - .../support/ResourceScriptSource.java | 1 - .../validation/DataBinder.java | 2 -- .../BeanNamePointcutAtAspectTests.java | 6 +---- .../DeclarationOrderIndependenceTests.java | 22 +++---------------- .../aop/aspectj/DeclareParentsTests.java | 5 ----- .../aop/framework/AbstractAopProxyTests.java | 5 +---- .../AdvisorAutoProxyCreatorTests.java | 4 +--- .../interceptor/ExpressionEvaluatorTests.java | 8 +++---- .../BeanMethodPolymorphismTests.java | 4 +--- .../ConfigurationClassPostProcessorTests.java | 4 ++-- .../ConfigurationClassSpr8954Tests.java | 3 +-- .../FooServiceDependentConverter.java | 1 + .../ReflectionUtilsIntegrationTests.java | 1 - .../ImportAnnotationDetectionTests.java | 4 +--- .../context/support/Assembler.java | 1 + .../ClassPathXmlApplicationContextTests.java | 1 - .../context/support/Logic.java | 10 +++------ .../standard/DateTimeFormattingTests.java | 1 - .../groovy/GroovyScriptFactoryTests.java | 3 ++- 27 files changed, 36 insertions(+), 83 deletions(-) diff --git a/spring-context/src/main/java/org/springframework/cache/interceptor/CacheAspectSupport.java b/spring-context/src/main/java/org/springframework/cache/interceptor/CacheAspectSupport.java index 31f80c69d3..16eba6a8e7 100644 --- a/spring-context/src/main/java/org/springframework/cache/interceptor/CacheAspectSupport.java +++ b/spring-context/src/main/java/org/springframework/cache/interceptor/CacheAspectSupport.java @@ -61,6 +61,7 @@ import org.springframework.util.StringUtils; * @author Juergen Hoeller * @author Chris Beams * @author Phillip Webb + * @author Sam Brannen * @since 3.1 */ public abstract class CacheAspectSupport implements InitializingBean { @@ -148,7 +149,7 @@ public abstract class CacheAspectSupport implements InitializingBean { return ClassUtils.getQualifiedMethodName(specificMethod); } - protected Collection getCaches(CacheOperation operation) { + protected Collection getCaches(CacheOperation operation) { Set cacheNames = operation.getCacheNames(); Collection caches = new ArrayList(cacheNames.size()); for (String cacheName : cacheNames) { @@ -346,7 +347,7 @@ public abstract class CacheAspectSupport implements InitializingBean { private final Class targetClass; - private final Collection caches; + private final Collection caches; public CacheOperationContext(CacheOperation operation, Method method, Object[] args, Object target, Class targetClass) { @@ -408,7 +409,7 @@ public abstract class CacheAspectSupport implements InitializingBean { return evaluator.createEvaluationContext(this.caches, this.method, this.args, this.target, this.targetClass, result); } - protected Collection getCaches() { + protected Collection getCaches() { return this.caches; } } diff --git a/spring-context/src/main/java/org/springframework/cache/interceptor/CacheExpressionRootObject.java b/spring-context/src/main/java/org/springframework/cache/interceptor/CacheExpressionRootObject.java index 525cf043d7..84b5d0a1db 100644 --- a/spring-context/src/main/java/org/springframework/cache/interceptor/CacheExpressionRootObject.java +++ b/spring-context/src/main/java/org/springframework/cache/interceptor/CacheExpressionRootObject.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2013 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,13 +24,14 @@ import org.springframework.util.Assert; /** * Class describing the root object used during the expression evaluation. - * + * * @author Costin Leau + * @author Sam Brannen * @since 3.1 */ class CacheExpressionRootObject { - private final Collection caches; + private final Collection caches; private final Method method; @@ -42,7 +43,7 @@ class CacheExpressionRootObject { public CacheExpressionRootObject( - Collection caches, Method method, Object[] args, Object target, Class targetClass) { + Collection caches, Method method, Object[] args, Object target, Class targetClass) { Assert.notNull(method, "Method is required"); Assert.notNull(targetClass, "targetClass is required"); @@ -54,7 +55,7 @@ class CacheExpressionRootObject { } - public Collection getCaches() { + public Collection getCaches() { return this.caches; } diff --git a/spring-context/src/main/java/org/springframework/cache/interceptor/ExpressionEvaluator.java b/spring-context/src/main/java/org/springframework/cache/interceptor/ExpressionEvaluator.java index ac5a823951..9405c40346 100644 --- a/spring-context/src/main/java/org/springframework/cache/interceptor/ExpressionEvaluator.java +++ b/spring-context/src/main/java/org/springframework/cache/interceptor/ExpressionEvaluator.java @@ -36,6 +36,7 @@ import org.springframework.expression.spel.standard.SpelExpressionParser; * * @author Costin Leau * @author Phillip Webb + * @author Sam Brannen * @since 3.1 */ class ExpressionEvaluator { @@ -61,7 +62,7 @@ class ExpressionEvaluator { * Create an {@link EvaluationContext} without a return value. * @see #createEvaluationContext(Collection, Method, Object[], Object, Class, Object) */ - public EvaluationContext createEvaluationContext(Collection caches, + public EvaluationContext createEvaluationContext(Collection caches, Method method, Object[] args, Object target, Class targetClass) { return createEvaluationContext(caches, method, args, target, targetClass, NO_RESULT); @@ -77,9 +78,9 @@ class ExpressionEvaluator { * @param targetClass the target class * @param result the return value (can be {@code null}) or * {@link #NO_RESULT} if there is no return at this time - * @return the evalulation context + * @return the evaluation context */ - public EvaluationContext createEvaluationContext(Collection caches, + public EvaluationContext createEvaluationContext(Collection caches, Method method, Object[] args, Object target, Class targetClass, final Object result) { CacheExpressionRootObject rootObject = new CacheExpressionRootObject(caches, diff --git a/spring-context/src/main/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessor.java b/spring-context/src/main/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessor.java index c68cc5f751..2e58cc2177 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessor.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessor.java @@ -511,8 +511,6 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean */ private class ResourceElement extends LookupElement { - protected final boolean shareable; - public ResourceElement(Member member, PropertyDescriptor pd) { super(member, pd); AnnotatedElement ae = (AnnotatedElement) member; @@ -539,7 +537,6 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean this.name = resourceName; this.lookupType = resourceType; this.mappedName = resource.mappedName(); - this.shareable = resource.shareable(); } @Override diff --git a/spring-context/src/main/java/org/springframework/context/annotation/ConditionEvaluator.java b/spring-context/src/main/java/org/springframework/context/annotation/ConditionEvaluator.java index 8275bbfbf9..cc98804ea8 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/ConditionEvaluator.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/ConditionEvaluator.java @@ -29,7 +29,6 @@ import org.springframework.core.env.EnvironmentCapable; import org.springframework.core.io.ResourceLoader; import org.springframework.core.type.AnnotatedTypeMetadata; import org.springframework.core.type.AnnotationMetadata; -import org.springframework.util.Assert; import org.springframework.util.ClassUtils; import org.springframework.util.MultiValueMap; diff --git a/spring-context/src/main/java/org/springframework/context/weaving/DefaultContextLoadTimeWeaver.java b/spring-context/src/main/java/org/springframework/context/weaving/DefaultContextLoadTimeWeaver.java index c30f77d167..669d62925b 100644 --- a/spring-context/src/main/java/org/springframework/context/weaving/DefaultContextLoadTimeWeaver.java +++ b/spring-context/src/main/java/org/springframework/context/weaving/DefaultContextLoadTimeWeaver.java @@ -53,7 +53,6 @@ import org.springframework.instrument.classloading.websphere.WebSphereLoadTimeWe * @since 2.5 * @see org.springframework.context.ConfigurableApplicationContext#LOAD_TIME_WEAVER_BEAN_NAME */ -@SuppressWarnings("deprecation") public class DefaultContextLoadTimeWeaver implements LoadTimeWeaver, BeanClassLoaderAware, DisposableBean { protected final Log logger = LogFactory.getLog(getClass()); diff --git a/spring-context/src/main/java/org/springframework/scheduling/support/MethodInvokingRunnable.java b/spring-context/src/main/java/org/springframework/scheduling/support/MethodInvokingRunnable.java index fec7cc84b8..d835c37be3 100644 --- a/spring-context/src/main/java/org/springframework/scheduling/support/MethodInvokingRunnable.java +++ b/spring-context/src/main/java/org/springframework/scheduling/support/MethodInvokingRunnable.java @@ -51,7 +51,7 @@ public class MethodInvokingRunnable extends ArgumentConvertingMethodInvoker } @Override - protected Class resolveClassName(String className) throws ClassNotFoundException { + protected Class resolveClassName(String className) throws ClassNotFoundException { return ClassUtils.forName(className, this.beanClassLoader); } diff --git a/spring-context/src/main/java/org/springframework/scripting/groovy/GroovyScriptEvaluator.java b/spring-context/src/main/java/org/springframework/scripting/groovy/GroovyScriptEvaluator.java index fbcd7a0512..14b4a41a95 100644 --- a/spring-context/src/main/java/org/springframework/scripting/groovy/GroovyScriptEvaluator.java +++ b/spring-context/src/main/java/org/springframework/scripting/groovy/GroovyScriptEvaluator.java @@ -1,7 +1,6 @@ package org.springframework.scripting.groovy; import java.io.IOException; -import java.util.Collections; import java.util.Map; import groovy.lang.Binding; diff --git a/spring-context/src/main/java/org/springframework/scripting/support/ResourceScriptSource.java b/spring-context/src/main/java/org/springframework/scripting/support/ResourceScriptSource.java index 75bc8ccb93..3e4c1df36b 100644 --- a/spring-context/src/main/java/org/springframework/scripting/support/ResourceScriptSource.java +++ b/spring-context/src/main/java/org/springframework/scripting/support/ResourceScriptSource.java @@ -17,7 +17,6 @@ package org.springframework.scripting.support; import java.io.IOException; -import java.io.InputStream; import java.io.Reader; import org.apache.commons.logging.Log; diff --git a/spring-context/src/main/java/org/springframework/validation/DataBinder.java b/spring-context/src/main/java/org/springframework/validation/DataBinder.java index 30657d6e71..dd4d4be385 100644 --- a/spring-context/src/main/java/org/springframework/validation/DataBinder.java +++ b/spring-context/src/main/java/org/springframework/validation/DataBinder.java @@ -127,8 +127,6 @@ public class DataBinder implements PropertyEditorRegistry, TypeConverter { private SimpleTypeConverter typeConverter; - private BindException bindException; - private boolean ignoreUnknownFields = true; private boolean ignoreInvalidFields = false; diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutAtAspectTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutAtAspectTests.java index 4ab6a83064..48a0475210 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutAtAspectTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutAtAspectTests.java @@ -37,21 +37,17 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; public final class BeanNamePointcutAtAspectTests { private ITestBean testBean1; - - private ITestBean testBean2; - private ITestBean testBean3; - private CounterAspect counterAspect; @org.junit.Before + @SuppressWarnings("resource") public void setUp() { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass()); counterAspect = (CounterAspect) ctx.getBean("counterAspect"); testBean1 = (ITestBean) ctx.getBean("testBean1"); - testBean2 = (ITestBean) ctx.getBean("testBean2"); testBean3 = (ITestBean) ctx.getBean("testBean3"); } diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/DeclarationOrderIndependenceTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/DeclarationOrderIndependenceTests.java index 07542c3cab..9ef74f80b5 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/DeclarationOrderIndependenceTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/DeclarationOrderIndependenceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,6 +38,7 @@ public final class DeclarationOrderIndependenceTests { @Before + @SuppressWarnings("resource") public void setUp() { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass()); @@ -83,11 +84,9 @@ public final class DeclarationOrderIndependenceTests { /** public visibility is required */ public static class BeanNameAwareMixin implements BeanNameAware { + @SuppressWarnings("unused") private String beanName; - /* (non-Javadoc) - * @see org.springframework.beans.factory.BeanNameAware#setBeanName(java.lang.String) - */ @Override public void setBeanName(String name) { this.beanName = name; @@ -146,17 +145,11 @@ class TopsyTurvyTargetImpl implements TopsyTurvyTarget { private int x = 5; - /* (non-Javadoc) - * @see org.springframework.aop.aspectj.TopsyTurvyTarget#doSomething() - */ @Override public void doSomething() { this.x = 10; } - /* (non-Javadoc) - * @see org.springframework.aop.aspectj.TopsyTurvyTarget#getX() - */ @Override public int getX() { return x; @@ -171,25 +164,16 @@ class AspectCollaborator implements TopsyTurvyAspect.Collaborator { public boolean aroundFired = false; public boolean beforeFired = false; - /* (non-Javadoc) - * @see org.springframework.aop.aspectj.TopsyTurvyAspect.Collaborator#afterReturningAdviceFired() - */ @Override public void afterReturningAdviceFired() { this.afterReturningFired = true; } - /* (non-Javadoc) - * @see org.springframework.aop.aspectj.TopsyTurvyAspect.Collaborator#aroundAdviceFired() - */ @Override public void aroundAdviceFired() { this.aroundFired = true; } - /* (non-Javadoc) - * @see org.springframework.aop.aspectj.TopsyTurvyAspect.Collaborator#beforeAdviceFired() - */ @Override public void beforeAdviceFired() { this.beforeFired = true; diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/DeclareParentsTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/DeclareParentsTests.java index c2948de1ab..6d5391c094 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/DeclareParentsTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/DeclareParentsTests.java @@ -39,8 +39,6 @@ public final class DeclareParentsTests { private ITestBean testBeanProxy; - private TestBean testBeanTarget; - private ApplicationContext ctx; @Before @@ -49,9 +47,6 @@ public final class DeclareParentsTests { testBeanProxy = (ITestBean) ctx.getBean("testBean"); assertTrue(AopUtils.isAopProxy(testBeanProxy)); - - // we need the real target too, not just the proxy... - testBeanTarget = (TestBean) ((Advised) testBeanProxy).getTargetSource().getTarget(); } @Test diff --git a/spring-context/src/test/java/org/springframework/aop/framework/AbstractAopProxyTests.java b/spring-context/src/test/java/org/springframework/aop/framework/AbstractAopProxyTests.java index ff76f28211..7c37c37adc 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/AbstractAopProxyTests.java +++ b/spring-context/src/test/java/org/springframework/aop/framework/AbstractAopProxyTests.java @@ -1776,7 +1776,6 @@ public abstract class AbstractAopProxyTests { protected static class TestStaticPointcutAdvice extends StaticMethodMatcherPointcutAdvisor { private String pattern; - private int count; public TestStaticPointcutAdvice(MethodInterceptor mi, String pattern) { super(mi); @@ -1784,9 +1783,7 @@ public abstract class AbstractAopProxyTests { } @Override public boolean matches(Method m, Class targetClass) { - boolean run = m.getName().indexOf(pattern) != -1; - if (run) ++count; - return run; + return m.getName().indexOf(pattern) != -1; } } diff --git a/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/AdvisorAutoProxyCreatorTests.java b/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/AdvisorAutoProxyCreatorTests.java index bf1fc8b5a7..3e508dfb48 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/AdvisorAutoProxyCreatorTests.java +++ b/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/AdvisorAutoProxyCreatorTests.java @@ -49,6 +49,7 @@ import test.mixin.Lockable; * @author Dave Syer * @author Chris Beams */ +@SuppressWarnings("resource") public final class AdvisorAutoProxyCreatorTests { private static final Class CLASS = AdvisorAutoProxyCreatorTests.class; @@ -60,9 +61,6 @@ public final class AdvisorAutoProxyCreatorTests { private static final String QUICK_TARGETSOURCE_CONTEXT = CLASSNAME + "-quick-targetsource.xml"; private static final String OPTIMIZED_CONTEXT = CLASSNAME + "-optimized.xml"; - private static final String ADVISOR_APC_BEAN_NAME = "aapc"; - private static final String TXMANAGER_BEAN_NAME = "txManager"; - /** * Return a bean factory with attributes and EnterpriseServices configured. */ diff --git a/spring-context/src/test/java/org/springframework/cache/interceptor/ExpressionEvaluatorTests.java b/spring-context/src/test/java/org/springframework/cache/interceptor/ExpressionEvaluatorTests.java index 22ca4e9784..05f0043e51 100644 --- a/spring-context/src/test/java/org/springframework/cache/interceptor/ExpressionEvaluatorTests.java +++ b/spring-context/src/test/java/org/springframework/cache/interceptor/ExpressionEvaluatorTests.java @@ -24,7 +24,6 @@ import java.util.Iterator; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; - import org.springframework.cache.annotation.AnnotationCacheOperationSource; import org.springframework.cache.annotation.Cacheable; import org.springframework.cache.annotation.Caching; @@ -39,6 +38,7 @@ import static org.junit.Assert.*; /** * @author Costin Leau * @author Phillip Webb + * @author Sam Brannen */ public class ExpressionEvaluatorTests { @@ -70,13 +70,12 @@ public class ExpressionEvaluatorTests { } @Test - @SuppressWarnings("unchecked") public void testMultipleCachingEval() throws Exception { AnnotatedClass target = new AnnotatedClass(); Method method = ReflectionUtils.findMethod(AnnotatedClass.class, "multipleCaching", Object.class, Object.class); Object[] args = new Object[] { new Object(), new Object() }; - Collection caches = Collections.singleton(new ConcurrentMapCache("test")); + Collection caches = Collections.singleton(new ConcurrentMapCache("test")); EvaluationContext evalCtx = eval.createEvaluationContext(caches, method, args, target, target.getClass()); Collection ops = getOps("multipleCaching"); @@ -116,8 +115,7 @@ public class ExpressionEvaluatorTests { Method method = ReflectionUtils.findMethod(AnnotatedClass.class, "multipleCaching", Object.class, Object.class); Object[] args = new Object[] { new Object(), new Object() }; - @SuppressWarnings("unchecked") - Collection caches = Collections.singleton(new ConcurrentMapCache("test")); + Collection caches = Collections.singleton(new ConcurrentMapCache("test")); EvaluationContext context = eval.createEvaluationContext(caches, method, args, target, target.getClass(), result); return context; } diff --git a/spring-context/src/test/java/org/springframework/context/annotation/BeanMethodPolymorphismTests.java b/spring-context/src/test/java/org/springframework/context/annotation/BeanMethodPolymorphismTests.java index ea6c84aa9a..1994444485 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/BeanMethodPolymorphismTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/BeanMethodPolymorphismTests.java @@ -20,9 +20,6 @@ import java.util.List; import org.junit.Test; -import org.springframework.beans.factory.support.DefaultListableBeanFactory; -import org.springframework.beans.factory.support.RootBeanDefinition; - import static org.hamcrest.CoreMatchers.*; import static org.junit.Assert.*; @@ -34,6 +31,7 @@ import static org.junit.Assert.*; * @author Phillip Webb * @author Juergen Hoeller */ +@SuppressWarnings("resource") public class BeanMethodPolymorphismTests { @Test diff --git a/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassPostProcessorTests.java b/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassPostProcessorTests.java index d4de8de1e5..cdcc1ecc29 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassPostProcessorTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassPostProcessorTests.java @@ -120,8 +120,8 @@ public class ConfigurationClassPostProcessorTests { beanFactory.registerBeanDefinition("config", new RootBeanDefinition(SingletonBeanConfig.class)); ConfigurationClassPostProcessor pp = new ConfigurationClassPostProcessor(); pp.postProcessBeanFactory(beanFactory); - Foo foo = beanFactory.getBean("foo", Foo.class); - TestBean bar = beanFactory.getBean("bar", TestBean.class); + beanFactory.getBean("foo", Foo.class); + beanFactory.getBean("bar", TestBean.class); } @Test diff --git a/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassSpr8954Tests.java b/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassSpr8954Tests.java index 1a7a5b1b33..fe43ca204e 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassSpr8954Tests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassSpr8954Tests.java @@ -19,10 +19,8 @@ package org.springframework.context.annotation; import java.util.Map; import org.junit.Test; - import org.springframework.beans.factory.FactoryBean; import org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessorAdapter; -import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.support.RootBeanDefinition; import static org.hamcrest.CoreMatchers.*; @@ -39,6 +37,7 @@ import static org.junit.Assert.*; * @author Chris Beams * @author Oliver Gierke */ +@SuppressWarnings("resource") public class ConfigurationClassSpr8954Tests { @Test diff --git a/spring-context/src/test/java/org/springframework/context/annotation/FooServiceDependentConverter.java b/spring-context/src/test/java/org/springframework/context/annotation/FooServiceDependentConverter.java index eab6f37b7f..6442117663 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/FooServiceDependentConverter.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/FooServiceDependentConverter.java @@ -25,6 +25,7 @@ import org.springframework.core.convert.converter.Converter; */ public class FooServiceDependentConverter implements Converter { + @SuppressWarnings("unused") private FooService fooService; public void setFooService(FooService fooService) { diff --git a/spring-context/src/test/java/org/springframework/context/annotation/ReflectionUtilsIntegrationTests.java b/spring-context/src/test/java/org/springframework/context/annotation/ReflectionUtilsIntegrationTests.java index 41e23a10da..8974528c71 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/ReflectionUtilsIntegrationTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/ReflectionUtilsIntegrationTests.java @@ -23,7 +23,6 @@ import static org.junit.Assert.assertThat; import java.lang.reflect.Method; import org.junit.Test; -import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.util.ReflectionUtils; /** diff --git a/spring-context/src/test/java/org/springframework/context/annotation/configuration/ImportAnnotationDetectionTests.java b/spring-context/src/test/java/org/springframework/context/annotation/configuration/ImportAnnotationDetectionTests.java index b24041cf92..61ae62b803 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/configuration/ImportAnnotationDetectionTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/configuration/ImportAnnotationDetectionTests.java @@ -25,15 +25,12 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.junit.Test; -import org.springframework.stereotype.Service; import org.springframework.tests.sample.beans.TestBean; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; -import static org.junit.Assert.*; - /** * Tests that @Import may be used both as a locally declared and meta-declared * annotation, that all declarations are processed, and that any local declaration @@ -42,6 +39,7 @@ import static org.junit.Assert.*; * @author Chris Beams * @since 3.1 */ +@SuppressWarnings("resource") public class ImportAnnotationDetectionTests { @Test diff --git a/spring-context/src/test/java/org/springframework/context/support/Assembler.java b/spring-context/src/test/java/org/springframework/context/support/Assembler.java index 26c750cff6..e62856b5c1 100644 --- a/spring-context/src/test/java/org/springframework/context/support/Assembler.java +++ b/spring-context/src/test/java/org/springframework/context/support/Assembler.java @@ -21,6 +21,7 @@ package org.springframework.context.support; */ public class Assembler implements TestIF { + @SuppressWarnings("unused") private Service service; private Logic l; private String name; diff --git a/spring-context/src/test/java/org/springframework/context/support/ClassPathXmlApplicationContextTests.java b/spring-context/src/test/java/org/springframework/context/support/ClassPathXmlApplicationContextTests.java index 7ff83e35ea..62223519fe 100644 --- a/spring-context/src/test/java/org/springframework/context/support/ClassPathXmlApplicationContextTests.java +++ b/spring-context/src/test/java/org/springframework/context/support/ClassPathXmlApplicationContextTests.java @@ -69,7 +69,6 @@ public final class ClassPathXmlApplicationContextTests { private static final String ALIAS_THAT_OVERRIDES_PARENT_CONTEXT = PATH + "aliasThatOverridesParent.xml"; private static final String ALIAS_FOR_PARENT_CONTEXT = PATH + "aliasForParent.xml"; private static final String TEST_PROPERTIES = "test.properties"; - private static final String FQ_TEST_PROPERTIES = "classpath:org/springframework/beans/factory/xml/" + TEST_PROPERTIES; @Test diff --git a/spring-context/src/test/java/org/springframework/context/support/Logic.java b/spring-context/src/test/java/org/springframework/context/support/Logic.java index 79daad0e29..aed08c5dbd 100644 --- a/spring-context/src/test/java/org/springframework/context/support/Logic.java +++ b/spring-context/src/test/java/org/springframework/context/support/Logic.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,24 +16,20 @@ package org.springframework.context.support; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.BeanNameAware; public class Logic implements BeanNameAware { - private Log log = LogFactory.getLog(Logic.class); private String name; + + @SuppressWarnings("unused") private Assembler a; public void setAssembler(Assembler a) { this.a = a; } - /* (non-Javadoc) - * @see org.springframework.beans.factory.BeanNameAware#setBeanName(java.lang.String) - */ @Override public void setBeanName(String name) { this.name = name; diff --git a/spring-context/src/test/java/org/springframework/format/datetime/standard/DateTimeFormattingTests.java b/spring-context/src/test/java/org/springframework/format/datetime/standard/DateTimeFormattingTests.java index a7100ba157..d12f311061 100644 --- a/spring-context/src/test/java/org/springframework/format/datetime/standard/DateTimeFormattingTests.java +++ b/spring-context/src/test/java/org/springframework/format/datetime/standard/DateTimeFormattingTests.java @@ -292,7 +292,6 @@ public class DateTimeFormattingTests { } - @SuppressWarnings("unused") public static class DateTimeBean { private LocalDate localDate; diff --git a/spring-context/src/test/java/org/springframework/scripting/groovy/GroovyScriptFactoryTests.java b/spring-context/src/test/java/org/springframework/scripting/groovy/GroovyScriptFactoryTests.java index 8c01b785af..1bdd0901bb 100644 --- a/spring-context/src/test/java/org/springframework/scripting/groovy/GroovyScriptFactoryTests.java +++ b/spring-context/src/test/java/org/springframework/scripting/groovy/GroovyScriptFactoryTests.java @@ -22,10 +22,10 @@ import java.util.Map; import groovy.lang.DelegatingMetaClass; import groovy.lang.GroovyObject; + import org.junit.Before; import org.junit.Ignore; import org.junit.Test; - import org.springframework.aop.support.AopUtils; import org.springframework.aop.target.dynamic.Refreshable; import org.springframework.beans.factory.BeanCreationException; @@ -61,6 +61,7 @@ import static org.mockito.BDDMockito.*; * @author Mark Fisher * @author Chris Beams */ +@SuppressWarnings("resource") public class GroovyScriptFactoryTests { @Before