Browse Source

Polish spring-context

- Cache interceptor internals now operate on collections of
   <? extends Cache> instead of <Cache>.
 - 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.
pull/409/head
Sam Brannen 11 years ago
parent
commit
d67fe1db86
  1. 7
      spring-context/src/main/java/org/springframework/cache/interceptor/CacheAspectSupport.java
  2. 9
      spring-context/src/main/java/org/springframework/cache/interceptor/CacheExpressionRootObject.java
  3. 7
      spring-context/src/main/java/org/springframework/cache/interceptor/ExpressionEvaluator.java
  4. 3
      spring-context/src/main/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessor.java
  5. 1
      spring-context/src/main/java/org/springframework/context/annotation/ConditionEvaluator.java
  6. 1
      spring-context/src/main/java/org/springframework/context/weaving/DefaultContextLoadTimeWeaver.java
  7. 2
      spring-context/src/main/java/org/springframework/scheduling/support/MethodInvokingRunnable.java
  8. 1
      spring-context/src/main/java/org/springframework/scripting/groovy/GroovyScriptEvaluator.java
  9. 1
      spring-context/src/main/java/org/springframework/scripting/support/ResourceScriptSource.java
  10. 2
      spring-context/src/main/java/org/springframework/validation/DataBinder.java
  11. 6
      spring-context/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutAtAspectTests.java
  12. 22
      spring-context/src/test/java/org/springframework/aop/aspectj/DeclarationOrderIndependenceTests.java
  13. 5
      spring-context/src/test/java/org/springframework/aop/aspectj/DeclareParentsTests.java
  14. 5
      spring-context/src/test/java/org/springframework/aop/framework/AbstractAopProxyTests.java
  15. 4
      spring-context/src/test/java/org/springframework/aop/framework/autoproxy/AdvisorAutoProxyCreatorTests.java
  16. 8
      spring-context/src/test/java/org/springframework/cache/interceptor/ExpressionEvaluatorTests.java
  17. 4
      spring-context/src/test/java/org/springframework/context/annotation/BeanMethodPolymorphismTests.java
  18. 4
      spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassPostProcessorTests.java
  19. 3
      spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassSpr8954Tests.java
  20. 1
      spring-context/src/test/java/org/springframework/context/annotation/FooServiceDependentConverter.java
  21. 1
      spring-context/src/test/java/org/springframework/context/annotation/ReflectionUtilsIntegrationTests.java
  22. 4
      spring-context/src/test/java/org/springframework/context/annotation/configuration/ImportAnnotationDetectionTests.java
  23. 1
      spring-context/src/test/java/org/springframework/context/support/Assembler.java
  24. 1
      spring-context/src/test/java/org/springframework/context/support/ClassPathXmlApplicationContextTests.java
  25. 10
      spring-context/src/test/java/org/springframework/context/support/Logic.java
  26. 1
      spring-context/src/test/java/org/springframework/format/datetime/standard/DateTimeFormattingTests.java
  27. 3
      spring-context/src/test/java/org/springframework/scripting/groovy/GroovyScriptFactoryTests.java

7
spring-context/src/main/java/org/springframework/cache/interceptor/CacheAspectSupport.java vendored

@ -61,6 +61,7 @@ import org.springframework.util.StringUtils; @@ -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 { @@ -148,7 +149,7 @@ public abstract class CacheAspectSupport implements InitializingBean {
return ClassUtils.getQualifiedMethodName(specificMethod);
}
protected Collection<Cache> getCaches(CacheOperation operation) {
protected Collection<? extends Cache> getCaches(CacheOperation operation) {
Set<String> cacheNames = operation.getCacheNames();
Collection<Cache> caches = new ArrayList<Cache>(cacheNames.size());
for (String cacheName : cacheNames) {
@ -346,7 +347,7 @@ public abstract class CacheAspectSupport implements InitializingBean { @@ -346,7 +347,7 @@ public abstract class CacheAspectSupport implements InitializingBean {
private final Class<?> targetClass;
private final Collection<Cache> caches;
private final Collection<? extends Cache> caches;
public CacheOperationContext(CacheOperation operation, Method method,
Object[] args, Object target, Class<?> targetClass) {
@ -408,7 +409,7 @@ public abstract class CacheAspectSupport implements InitializingBean { @@ -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<Cache> getCaches() {
protected Collection<? extends Cache> getCaches() {
return this.caches;
}
}

9
spring-context/src/main/java/org/springframework/cache/interceptor/CacheExpressionRootObject.java vendored

@ -1,5 +1,5 @@ @@ -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.
@ -26,11 +26,12 @@ import org.springframework.util.Assert; @@ -26,11 +26,12 @@ 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<Cache> caches;
private final Collection<? extends Cache> caches;
private final Method method;
@ -42,7 +43,7 @@ class CacheExpressionRootObject { @@ -42,7 +43,7 @@ class CacheExpressionRootObject {
public CacheExpressionRootObject(
Collection<Cache> caches, Method method, Object[] args, Object target, Class<?> targetClass) {
Collection<? extends Cache> 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 { @@ -54,7 +55,7 @@ class CacheExpressionRootObject {
}
public Collection<Cache> getCaches() {
public Collection<? extends Cache> getCaches() {
return this.caches;
}

7
spring-context/src/main/java/org/springframework/cache/interceptor/ExpressionEvaluator.java vendored

@ -36,6 +36,7 @@ import org.springframework.expression.spel.standard.SpelExpressionParser; @@ -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 { @@ -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<Cache> caches,
public EvaluationContext createEvaluationContext(Collection<? extends Cache> caches,
Method method, Object[] args, Object target, Class<?> targetClass) {
return createEvaluationContext(caches, method, args, target, targetClass,
NO_RESULT);
@ -77,9 +78,9 @@ class ExpressionEvaluator { @@ -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<Cache> caches,
public EvaluationContext createEvaluationContext(Collection<? extends Cache> caches,
Method method, Object[] args, Object target, Class<?> targetClass,
final Object result) {
CacheExpressionRootObject rootObject = new CacheExpressionRootObject(caches,

3
spring-context/src/main/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessor.java

@ -511,8 +511,6 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean @@ -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 @@ -539,7 +537,6 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean
this.name = resourceName;
this.lookupType = resourceType;
this.mappedName = resource.mappedName();
this.shareable = resource.shareable();
}
@Override

1
spring-context/src/main/java/org/springframework/context/annotation/ConditionEvaluator.java

@ -29,7 +29,6 @@ import org.springframework.core.env.EnvironmentCapable; @@ -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;

1
spring-context/src/main/java/org/springframework/context/weaving/DefaultContextLoadTimeWeaver.java

@ -53,7 +53,6 @@ import org.springframework.instrument.classloading.websphere.WebSphereLoadTimeWe @@ -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());

2
spring-context/src/main/java/org/springframework/scheduling/support/MethodInvokingRunnable.java

@ -51,7 +51,7 @@ public class MethodInvokingRunnable extends ArgumentConvertingMethodInvoker @@ -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);
}

1
spring-context/src/main/java/org/springframework/scripting/groovy/GroovyScriptEvaluator.java

@ -1,7 +1,6 @@ @@ -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;

1
spring-context/src/main/java/org/springframework/scripting/support/ResourceScriptSource.java

@ -17,7 +17,6 @@ @@ -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;

2
spring-context/src/main/java/org/springframework/validation/DataBinder.java

@ -127,8 +127,6 @@ public class DataBinder implements PropertyEditorRegistry, TypeConverter { @@ -127,8 +127,6 @@ public class DataBinder implements PropertyEditorRegistry, TypeConverter {
private SimpleTypeConverter typeConverter;
private BindException bindException;
private boolean ignoreUnknownFields = true;
private boolean ignoreInvalidFields = false;

6
spring-context/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutAtAspectTests.java

@ -37,21 +37,17 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; @@ -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");
}

22
spring-context/src/test/java/org/springframework/aop/aspectj/DeclarationOrderIndependenceTests.java

@ -1,5 +1,5 @@ @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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;

5
spring-context/src/test/java/org/springframework/aop/aspectj/DeclareParentsTests.java

@ -39,8 +39,6 @@ public final class DeclareParentsTests { @@ -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 { @@ -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

5
spring-context/src/test/java/org/springframework/aop/framework/AbstractAopProxyTests.java

@ -1776,7 +1776,6 @@ public abstract class AbstractAopProxyTests { @@ -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 { @@ -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;
}
}

4
spring-context/src/test/java/org/springframework/aop/framework/autoproxy/AdvisorAutoProxyCreatorTests.java

@ -49,6 +49,7 @@ import test.mixin.Lockable; @@ -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 { @@ -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.
*/

8
spring-context/src/test/java/org/springframework/cache/interceptor/ExpressionEvaluatorTests.java vendored

@ -24,7 +24,6 @@ import java.util.Iterator; @@ -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.*; @@ -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 { @@ -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<ConcurrentMapCache> caches = Collections.singleton(new ConcurrentMapCache("test"));
EvaluationContext evalCtx = eval.createEvaluationContext(caches, method, args, target, target.getClass());
Collection<CacheOperation> ops = getOps("multipleCaching");
@ -116,8 +115,7 @@ public class ExpressionEvaluatorTests { @@ -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<ConcurrentMapCache> caches = Collections.singleton(new ConcurrentMapCache("test"));
EvaluationContext context = eval.createEvaluationContext(caches, method, args, target, target.getClass(), result);
return context;
}

4
spring-context/src/test/java/org/springframework/context/annotation/BeanMethodPolymorphismTests.java

@ -20,9 +20,6 @@ import java.util.List; @@ -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.*; @@ -34,6 +31,7 @@ import static org.junit.Assert.*;
* @author Phillip Webb
* @author Juergen Hoeller
*/
@SuppressWarnings("resource")
public class BeanMethodPolymorphismTests {
@Test

4
spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassPostProcessorTests.java

@ -120,8 +120,8 @@ public class ConfigurationClassPostProcessorTests { @@ -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

3
spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassSpr8954Tests.java

@ -19,10 +19,8 @@ package org.springframework.context.annotation; @@ -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.*; @@ -39,6 +37,7 @@ import static org.junit.Assert.*;
* @author Chris Beams
* @author Oliver Gierke
*/
@SuppressWarnings("resource")
public class ConfigurationClassSpr8954Tests {
@Test

1
spring-context/src/test/java/org/springframework/context/annotation/FooServiceDependentConverter.java

@ -25,6 +25,7 @@ import org.springframework.core.convert.converter.Converter; @@ -25,6 +25,7 @@ import org.springframework.core.convert.converter.Converter;
*/
public class FooServiceDependentConverter implements Converter<String, org.springframework.tests.sample.beans.TestBean> {
@SuppressWarnings("unused")
private FooService fooService;
public void setFooService(FooService fooService) {

1
spring-context/src/test/java/org/springframework/context/annotation/ReflectionUtilsIntegrationTests.java

@ -23,7 +23,6 @@ import static org.junit.Assert.assertThat; @@ -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;
/**

4
spring-context/src/test/java/org/springframework/context/annotation/configuration/ImportAnnotationDetectionTests.java

@ -25,15 +25,12 @@ import java.lang.annotation.RetentionPolicy; @@ -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.*; @@ -42,6 +39,7 @@ import static org.junit.Assert.*;
* @author Chris Beams
* @since 3.1
*/
@SuppressWarnings("resource")
public class ImportAnnotationDetectionTests {
@Test

1
spring-context/src/test/java/org/springframework/context/support/Assembler.java

@ -21,6 +21,7 @@ package org.springframework.context.support; @@ -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;

1
spring-context/src/test/java/org/springframework/context/support/ClassPathXmlApplicationContextTests.java

@ -69,7 +69,6 @@ public final class ClassPathXmlApplicationContextTests { @@ -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

10
spring-context/src/test/java/org/springframework/context/support/Logic.java

@ -1,5 +1,5 @@ @@ -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 @@ @@ -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;

1
spring-context/src/test/java/org/springframework/format/datetime/standard/DateTimeFormattingTests.java

@ -292,7 +292,6 @@ public class DateTimeFormattingTests { @@ -292,7 +292,6 @@ public class DateTimeFormattingTests {
}
@SuppressWarnings("unused")
public static class DateTimeBean {
private LocalDate localDate;

3
spring-context/src/test/java/org/springframework/scripting/groovy/GroovyScriptFactoryTests.java

@ -22,10 +22,10 @@ import java.util.Map; @@ -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.*; @@ -61,6 +61,7 @@ import static org.mockito.BDDMockito.*;
* @author Mark Fisher
* @author Chris Beams
*/
@SuppressWarnings("resource")
public class GroovyScriptFactoryTests {
@Before

Loading…
Cancel
Save