From 88f5dd6ce1a176eb17fc2f65890e2f3f2b603a03 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Fri, 25 Jan 2013 11:27:51 -0800 Subject: [PATCH 1/5] Fix 'is already an instance of type' warnings --- .../AbstractAspectJAdvisorFactoryTests.java | 19 ++++++---- ...elegatingIntroductionInterceptorTests.java | 4 ++- .../beans/BeanWrapperAutoGrowingTests.java | 35 ++++++++++--------- .../ConversionServiceFactoryBeanTests.java | 5 +-- .../scheduling/timer/TimerSupportTests.java | 5 ++- .../ServletAnnotationControllerTests.java | 24 ++++++++----- .../web/servlet/tags/UrlTagTests.java | 7 ++-- .../freemarker/FreeMarkerConfigurerTests.java | 7 ++-- .../velocity/VelocityConfigurerTests.java | 19 +++++----- 9 files changed, 77 insertions(+), 48 deletions(-) diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AbstractAspectJAdvisorFactoryTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AbstractAspectJAdvisorFactoryTests.java index 273869e8a0..3faf43c07c 100644 --- a/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AbstractAspectJAdvisorFactoryTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AbstractAspectJAdvisorFactoryTests.java @@ -15,7 +15,14 @@ */ package org.springframework.aop.aspectj.annotation; -import static org.junit.Assert.*; +import static org.hamcrest.Matchers.instanceOf; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotSame; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import java.io.FileNotFoundException; import java.lang.annotation.Retention; @@ -39,9 +46,7 @@ import org.aspectj.lang.annotation.DeclareParents; import org.aspectj.lang.annotation.DeclarePrecedence; import org.aspectj.lang.annotation.Pointcut; import org.aspectj.lang.reflect.MethodSignature; - import org.junit.Test; - import org.springframework.aop.Advisor; import org.springframework.aop.aspectj.annotation.ReflectiveAspectJAdvisorFactory.SyntheticInstantiationAdvisor; import org.springframework.aop.framework.Advised; @@ -52,14 +57,14 @@ import org.springframework.aop.support.AopUtils; import org.springframework.core.OrderComparator; import org.springframework.core.Ordered; import org.springframework.core.annotation.Order; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.util.ObjectUtils; import test.aop.DefaultLockable; import test.aop.Lockable; import test.aop.PerTargetAspect; import test.aop.TwoAdviceAspect; -import org.springframework.tests.sample.beans.ITestBean; -import org.springframework.tests.sample.beans.TestBean; /** * Abstract tests for AspectJAdvisorFactory. @@ -385,7 +390,7 @@ public abstract class AbstractAspectJAdvisorFactoryTests { CannotBeUnlocked.class ), CannotBeUnlocked.class); - assertTrue(proxy instanceof Lockable); + assertThat(proxy, instanceOf(Lockable.class)); Lockable lockable = proxy; assertTrue("Already locked", lockable.locked()); lockable.lock(); @@ -442,7 +447,7 @@ public abstract class AbstractAspectJAdvisorFactoryTests { Modifiable modifiable = (Modifiable) createProxy(target, advisors, ITestBean.class); - assertTrue(modifiable instanceof Modifiable); + assertThat(modifiable, instanceOf(Modifiable.class)); Lockable lockable = (Lockable) modifiable; assertFalse(lockable.locked()); diff --git a/spring-aop/src/test/java/org/springframework/aop/support/DelegatingIntroductionInterceptorTests.java b/spring-aop/src/test/java/org/springframework/aop/support/DelegatingIntroductionInterceptorTests.java index 1872a457f9..7a7257ea2f 100644 --- a/spring-aop/src/test/java/org/springframework/aop/support/DelegatingIntroductionInterceptorTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/support/DelegatingIntroductionInterceptorTests.java @@ -16,8 +16,10 @@ package org.springframework.aop.support; +import static org.hamcrest.Matchers.instanceOf; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; @@ -157,7 +159,7 @@ public final class DelegatingIntroductionInterceptorTests { //assertTrue(Arrays.binarySearch(pf.getProxiedInterfaces(), TimeStamped.class) != -1); TimeStamped ts = (TimeStamped) pf.getProxy(); - assertTrue(ts instanceof TimeStamped); + assertThat(ts, instanceOf(TimeStamped.class)); // Shoulnd't proxy framework interfaces assertTrue(!(ts instanceof MethodInterceptor)); assertTrue(!(ts instanceof IntroductionInterceptor)); diff --git a/spring-beans/src/test/java/org/springframework/beans/BeanWrapperAutoGrowingTests.java b/spring-beans/src/test/java/org/springframework/beans/BeanWrapperAutoGrowingTests.java index 73bdeaee1c..06a7eb86ac 100644 --- a/spring-beans/src/test/java/org/springframework/beans/BeanWrapperAutoGrowingTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/BeanWrapperAutoGrowingTests.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. @@ -22,6 +22,7 @@ import java.util.Map; import org.junit.Before; import org.junit.Test; +import static org.hamcrest.Matchers.instanceOf; import static org.junit.Assert.*; /** @@ -59,7 +60,7 @@ public class BeanWrapperAutoGrowingTests { public void getPropertyValueAutoGrowArray() { assertNotNull(wrapper.getPropertyValue("array[0]")); assertEquals(1, bean.getArray().length); - assertTrue(bean.getArray()[0] instanceof Bean); + assertThat(bean.getArray()[0], instanceOf(Bean.class)); } @Test @@ -72,11 +73,11 @@ public class BeanWrapperAutoGrowingTests { public void getPropertyValueAutoGrowArrayBySeveralElements() { assertNotNull(wrapper.getPropertyValue("array[4]")); assertEquals(5, bean.getArray().length); - assertTrue(bean.getArray()[0] instanceof Bean); - assertTrue(bean.getArray()[1] instanceof Bean); - assertTrue(bean.getArray()[2] instanceof Bean); - assertTrue(bean.getArray()[3] instanceof Bean); - assertTrue(bean.getArray()[4] instanceof Bean); + assertThat(bean.getArray()[0], instanceOf(Bean.class)); + assertThat(bean.getArray()[1], instanceOf(Bean.class)); + assertThat(bean.getArray()[2], instanceOf(Bean.class)); + assertThat(bean.getArray()[3], instanceOf(Bean.class)); + assertThat(bean.getArray()[4], instanceOf(Bean.class)); assertNotNull(wrapper.getPropertyValue("array[0]")); assertNotNull(wrapper.getPropertyValue("array[1]")); assertNotNull(wrapper.getPropertyValue("array[2]")); @@ -87,14 +88,14 @@ public class BeanWrapperAutoGrowingTests { public void getPropertyValueAutoGrowMultiDimensionalArray() { assertNotNull(wrapper.getPropertyValue("multiArray[0][0]")); assertEquals(1, bean.getMultiArray()[0].length); - assertTrue(bean.getMultiArray()[0][0] instanceof Bean); + assertThat(bean.getMultiArray()[0][0], instanceOf(Bean.class)); } @Test public void getPropertyValueAutoGrowList() { assertNotNull(wrapper.getPropertyValue("list[0]")); assertEquals(1, bean.getList().size()); - assertTrue(bean.getList().get(0) instanceof Bean); + assertThat(bean.getList().get(0), instanceOf(Bean.class)); } @Test @@ -107,11 +108,11 @@ public class BeanWrapperAutoGrowingTests { public void getPropertyValueAutoGrowListBySeveralElements() { assertNotNull(wrapper.getPropertyValue("list[4]")); assertEquals(5, bean.getList().size()); - assertTrue(bean.getList().get(0) instanceof Bean); - assertTrue(bean.getList().get(1) instanceof Bean); - assertTrue(bean.getList().get(2) instanceof Bean); - assertTrue(bean.getList().get(3) instanceof Bean); - assertTrue(bean.getList().get(4) instanceof Bean); + assertThat(bean.getList().get(0), instanceOf(Bean.class)); + assertThat(bean.getList().get(1), instanceOf(Bean.class)); + assertThat(bean.getList().get(2), instanceOf(Bean.class)); + assertThat(bean.getList().get(3), instanceOf(Bean.class)); + assertThat(bean.getList().get(4), instanceOf(Bean.class)); assertNotNull(wrapper.getPropertyValue("list[0]")); assertNotNull(wrapper.getPropertyValue("list[1]")); assertNotNull(wrapper.getPropertyValue("list[2]")); @@ -135,7 +136,7 @@ public class BeanWrapperAutoGrowingTests { public void getPropertyValueAutoGrowMultiDimensionalList() { assertNotNull(wrapper.getPropertyValue("multiList[0][0]")); assertEquals(1, bean.getMultiList().get(0).size()); - assertTrue(bean.getMultiList().get(0).get(0) instanceof Bean); + assertThat(bean.getMultiList().get(0).get(0), instanceOf(Bean.class)); } @Test(expected=InvalidPropertyException.class) @@ -146,13 +147,13 @@ public class BeanWrapperAutoGrowingTests { @Test public void setPropertyValueAutoGrowMap() { wrapper.setPropertyValue("map[A]", new Bean()); - assertTrue(bean.getMap().get("A") instanceof Bean); + assertThat(bean.getMap().get("A"), instanceOf(Bean.class)); } @Test public void setNestedPropertyValueAutoGrowMap() { wrapper.setPropertyValue("map[A].nested", new Bean()); - assertTrue(bean.getMap().get("A").getNested() instanceof Bean); + assertThat(bean.getMap().get("A").getNested(), instanceOf(Bean.class)); } diff --git a/spring-context/src/test/java/org/springframework/context/support/ConversionServiceFactoryBeanTests.java b/spring-context/src/test/java/org/springframework/context/support/ConversionServiceFactoryBeanTests.java index 676ff05a30..396e4a1bb0 100644 --- a/spring-context/src/test/java/org/springframework/context/support/ConversionServiceFactoryBeanTests.java +++ b/spring-context/src/test/java/org/springframework/context/support/ConversionServiceFactoryBeanTests.java @@ -33,6 +33,7 @@ import org.springframework.core.convert.converter.GenericConverter; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.FileSystemResource; +import static org.hamcrest.Matchers.instanceOf; import static org.junit.Assert.*; /** @@ -136,8 +137,8 @@ public class ConversionServiceFactoryBeanTests { public ComplexConstructorArgument(Map> map) { assertTrue(!map.isEmpty()); - assertTrue(map.keySet().iterator().next() instanceof String); - assertTrue(map.values().iterator().next() instanceof Class); + assertThat(map.keySet().iterator().next(), instanceOf(String.class)); + assertThat(map.values().iterator().next(), instanceOf(Class.class)); } } diff --git a/spring-context/src/test/java/org/springframework/scheduling/timer/TimerSupportTests.java b/spring-context/src/test/java/org/springframework/scheduling/timer/TimerSupportTests.java index 3beaf36b84..283ee0acf3 100644 --- a/spring-context/src/test/java/org/springframework/scheduling/timer/TimerSupportTests.java +++ b/spring-context/src/test/java/org/springframework/scheduling/timer/TimerSupportTests.java @@ -16,6 +16,9 @@ package org.springframework.scheduling.timer; +import static org.hamcrest.Matchers.instanceOf; +import static org.junit.Assert.assertThat; + import java.util.ArrayList; import java.util.List; import java.util.Timer; @@ -84,7 +87,7 @@ public class TimerSupportTests extends TestCase { try { timerFactoryBean.setScheduledTimerTasks(tasks); timerFactoryBean.afterPropertiesSet(); - assertTrue(timerFactoryBean.getObject() instanceof Timer); + assertThat(timerFactoryBean.getObject(), instanceOf(Timer.class)); timerTask0.run(); timerTask1.run(); timerTask2.run(); diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/ServletAnnotationControllerTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/ServletAnnotationControllerTests.java index bbfa7e2990..722099df3e 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/ServletAnnotationControllerTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/ServletAnnotationControllerTests.java @@ -16,6 +16,16 @@ package org.springframework.web.servlet.mvc.annotation; +import static org.hamcrest.Matchers.instanceOf; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + import java.beans.PropertyEditorSupport; import java.io.IOException; import java.io.Serializable; @@ -43,6 +53,7 @@ import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Set; + import javax.servlet.ServletConfig; import javax.servlet.ServletContext; import javax.servlet.ServletException; @@ -54,17 +65,12 @@ import javax.validation.constraints.NotNull; import javax.xml.bind.annotation.XmlRootElement; import org.junit.Test; - import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator; import org.springframework.aop.interceptor.SimpleTraceInterceptor; import org.springframework.aop.support.DefaultPointcutAdvisor; import org.springframework.beans.BeansException; -import org.springframework.tests.sample.beans.DerivedTestBean; -import org.springframework.tests.sample.beans.GenericBean; -import org.springframework.tests.sample.beans.ITestBean; import org.springframework.beans.PropertyEditorRegistrar; import org.springframework.beans.PropertyEditorRegistry; -import org.springframework.tests.sample.beans.TestBean; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -96,6 +102,10 @@ import org.springframework.mock.web.test.MockServletConfig; import org.springframework.mock.web.test.MockServletContext; import org.springframework.oxm.jaxb.Jaxb2Marshaller; import org.springframework.stereotype.Controller; +import org.springframework.tests.sample.beans.DerivedTestBean; +import org.springframework.tests.sample.beans.GenericBean; +import org.springframework.tests.sample.beans.ITestBean; +import org.springframework.tests.sample.beans.TestBean; import org.springframework.ui.ExtendedModelMap; import org.springframework.ui.Model; import org.springframework.ui.ModelMap; @@ -140,8 +150,6 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes; import org.springframework.web.servlet.view.InternalResourceViewResolver; import org.springframework.web.util.NestedServletException; -import static org.junit.Assert.*; - /** * @author Juergen Hoeller * @author Sam Brannen @@ -3291,7 +3299,7 @@ public class ServletAnnotationControllerTests { @RequestMapping("/integerSet") public void processCsv(@RequestParam("content") Set content, HttpServletResponse response) throws IOException { - assertTrue(content.iterator().next() instanceof Integer); + assertThat(content.iterator().next(), instanceOf(Integer.class)); response.getWriter().write(StringUtils.collectionToDelimitedString(content, "-")); } } diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/UrlTagTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/UrlTagTests.java index edabd11d4f..f66a8c2b50 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/UrlTagTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/UrlTagTests.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,6 +16,9 @@ package org.springframework.web.servlet.tags; +import static org.hamcrest.Matchers.instanceOf; +import static org.junit.Assert.assertThat; + import java.lang.reflect.Method; import java.util.HashSet; import java.util.LinkedList; @@ -49,7 +52,7 @@ public class UrlTagTests extends AbstractTagTests { } public void testParamSupport() { - assertTrue(tag instanceof ParamAware); + assertThat(tag, instanceOf(ParamAware.class)); } public void testDoStartTag() throws JspException { diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/freemarker/FreeMarkerConfigurerTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/freemarker/FreeMarkerConfigurerTests.java index 962b3fa33c..077c5b3a73 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/freemarker/FreeMarkerConfigurerTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/freemarker/FreeMarkerConfigurerTests.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,6 +16,9 @@ package org.springframework.web.servlet.view.freemarker; +import static org.hamcrest.Matchers.instanceOf; +import static org.junit.Assert.assertThat; + import java.io.IOException; import java.util.HashMap; import java.util.Properties; @@ -98,7 +101,7 @@ public class FreeMarkerConfigurerTests extends TestCase { } }); fcfb.afterPropertiesSet(); - assertTrue(fcfb.getObject() instanceof Configuration); + assertThat(fcfb.getObject(), instanceOf(Configuration.class)); Configuration fc = fcfb.getObject(); Template ft = fc.getTemplate("test"); assertEquals("test", FreeMarkerTemplateUtils.processTemplateIntoString(ft, new HashMap())); diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/velocity/VelocityConfigurerTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/velocity/VelocityConfigurerTests.java index 69f8ea613a..6475050597 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/velocity/VelocityConfigurerTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/velocity/VelocityConfigurerTests.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,6 +16,9 @@ package org.springframework.web.servlet.view.velocity; +import static org.hamcrest.Matchers.instanceOf; +import static org.junit.Assert.assertThat; + import java.io.File; import java.io.IOException; import java.net.MalformedURLException; @@ -25,9 +28,9 @@ import java.util.Properties; import java.util.Vector; import junit.framework.TestCase; + import org.apache.velocity.app.VelocityEngine; import org.apache.velocity.exception.VelocityException; - import org.springframework.core.io.ByteArrayResource; import org.springframework.core.io.DescriptiveResource; import org.springframework.core.io.FileSystemResource; @@ -68,7 +71,7 @@ public class VelocityConfigurerTests extends TestCase { map.put("myentry", value); vefb.setVelocityPropertiesMap(map); vefb.afterPropertiesSet(); - assertTrue(vefb.getObject() instanceof VelocityEngine); + assertThat(vefb.getObject(), instanceOf(VelocityEngine.class)); VelocityEngine ve = vefb.getObject(); assertEquals("/mydir", ve.getProperty("myprop")); assertEquals(value, ve.getProperty("myentry")); @@ -78,7 +81,7 @@ public class VelocityConfigurerTests extends TestCase { VelocityEngineFactoryBean vefb = new VelocityEngineFactoryBean(); vefb.setResourceLoaderPath("file:/mydir"); vefb.afterPropertiesSet(); - assertTrue(vefb.getObject() instanceof VelocityEngine); + assertThat(vefb.getObject(), instanceOf(VelocityEngine.class)); VelocityEngine ve = vefb.getObject(); assertEquals(new File("/mydir").getAbsolutePath(), ve.getProperty(VelocityEngine.FILE_RESOURCE_LOADER_PATH)); } @@ -105,7 +108,7 @@ public class VelocityConfigurerTests extends TestCase { } }); vefb.afterPropertiesSet(); - assertTrue(vefb.getObject() instanceof VelocityEngine); + assertThat(vefb.getObject(), instanceOf(VelocityEngine.class)); VelocityEngine ve = vefb.getObject(); assertEquals("test", VelocityEngineUtils.mergeTemplateIntoString(ve, "test", new HashMap())); } @@ -114,7 +117,7 @@ public class VelocityConfigurerTests extends TestCase { VelocityConfigurer vc = new VelocityConfigurer(); vc.setResourceLoaderPath("file:/mydir"); vc.afterPropertiesSet(); - assertTrue(vc.createVelocityEngine() instanceof VelocityEngine); + assertThat(vc.createVelocityEngine(), instanceOf(VelocityEngine.class)); VelocityEngine ve = vc.createVelocityEngine(); assertEquals(new File("/mydir").getAbsolutePath(), ve.getProperty(VelocityEngine.FILE_RESOURCE_LOADER_PATH)); } @@ -123,7 +126,7 @@ public class VelocityConfigurerTests extends TestCase { VelocityConfigurer vc = new VelocityConfigurer(); vc.setResourceLoaderPath("file:/mydir,file:/yourdir"); vc.afterPropertiesSet(); - assertTrue(vc.createVelocityEngine() instanceof VelocityEngine); + assertThat(vc.createVelocityEngine(), instanceOf(VelocityEngine.class)); VelocityEngine ve = vc.createVelocityEngine(); Vector paths = new Vector(); paths.add(new File("/mydir").getAbsolutePath()); @@ -149,7 +152,7 @@ public class VelocityConfigurerTests extends TestCase { }); vc.setPreferFileSystemAccess(false); vc.afterPropertiesSet(); - assertTrue(vc.createVelocityEngine() instanceof VelocityEngine); + assertThat(vc.createVelocityEngine(), instanceOf(VelocityEngine.class)); VelocityEngine ve = vc.createVelocityEngine(); assertEquals("test", VelocityEngineUtils.mergeTemplateIntoString(ve, "test", new HashMap())); } From 6a1e8419529ce908edc298639fa1691b4fbb2f11 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Fri, 25 Jan 2013 12:08:55 -0800 Subject: [PATCH 2/5] Fix unused type compiler warnings --- .../aop/aspectj/AspectJExpressionPointcutTests.java | 4 ---- .../TigerAspectJExpressionPointcutTests.java | 2 ++ .../adapter/ThrowsAdviceInterceptorTests.java | 2 +- .../aspectj/AbstractBeanConfigurerTests.java | 13 ++++++++++--- .../org/springframework/beans/BeanUtilsTests.java | 4 ++++ .../beans/BeanWrapperGenericsTests.java | 2 ++ .../org/springframework/beans/BeanWrapperTests.java | 10 ++++++++++ .../beans/ConcurrentBeanWrapperTests.java | 3 ++- .../factory/DefaultListableBeanFactoryTests.java | 4 ++++ .../factory/parsing/CustomProblemReporterTests.java | 4 ---- ...QualifierAnnotationAutowireBeanFactoryTests.java | 4 +++- .../support/security/CallbacksSecurityTests.java | 6 +++++- .../beans/factory/xml/FactoryMethods.java | 2 ++ .../CustomCollectionEditorTests.java | 4 ++-- .../beans/propertyeditors/CustomEditorTests.java | 3 +++ .../beans/support/PropertyComparatorTests.java | 3 ++- .../aop/framework/CglibProxyTests.java | 3 +++ .../InjectAnnotationAutowireContextTests.java | 3 ++- .../beans/factory/xml/QualifierAnnotationTests.java | 5 ++++- .../beans/factory/xml/XmlBeanFactoryTestTypes.java | 3 ++- .../CommonAnnotationBeanPostProcessorTests.java | 1 + ...ponentScanParserBeanDefinitionDefaultsTests.java | 5 ++++- .../ConfigurationClassProcessingTests.java | 6 ++++++ .../java/org/springframework/jmx/JmxTestBean.java | 4 +++- .../springframework/validation/DataBinderTests.java | 3 +++ .../PathMatchingResourcePatternResolver.java | 3 ++- .../core/BridgeMethodResolverTests.java | 3 +++ .../core/type/AnnotationTypeFilterTests.java | 6 +++++- .../core/type/AssignableTypeFilterTests.java | 4 +++- .../org/springframework/util/ClassUtilsTests.java | 8 +++++++- .../springframework/util/MethodInvokerTests.java | 3 ++- .../core/metadata/GenericTableMetaDataProvider.java | 12 +----------- .../datasource/DataSourceTransactionManager.java | 6 +----- .../BeanPropertySqlParameterSourceTests.java | 2 ++ .../DefaultJmsActivationSpecFactoryTests.java | 6 ++++-- .../orm/jdo/JdoInterceptorTests.java | 1 + .../orm/jpa/JpaInterceptorTests.java | 1 + .../oxm/jaxb/Jaxb2MarshallerTests.java | 4 +++- .../springframework/test/jpa/AbstractJpaTests.java | 4 +++- .../commons/CommonsMultipartResolverTests.java | 10 +--------- 40 files changed, 119 insertions(+), 57 deletions(-) diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJExpressionPointcutTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJExpressionPointcutTests.java index 429350b00d..b042d8155a 100644 --- a/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJExpressionPointcutTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJExpressionPointcutTests.java @@ -309,10 +309,6 @@ public final class AspectJExpressionPointcutTests { assertTrue("Expression should match TestBean class", classFilter.matches(TestBean.class)); } - private void assertDoesNotMatchStringClass(ClassFilter classFilter) { - assertFalse("Expression should not match String class", classFilter.matches(String.class)); - } - @Test public void testWithUnsupportedPointcutPrimitive() throws Exception { String expression = "call(int org.springframework.tests.sample.beans.TestBean.getAge())"; diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/TigerAspectJExpressionPointcutTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/TigerAspectJExpressionPointcutTests.java index 13635c2c6d..bc9f1b4f62 100644 --- a/spring-aop/src/test/java/org/springframework/aop/aspectj/TigerAspectJExpressionPointcutTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/TigerAspectJExpressionPointcutTests.java @@ -89,6 +89,8 @@ public final class TigerAspectJExpressionPointcutTests { @Test public void testMatchVarargs() throws SecurityException, NoSuchMethodException { + + @SuppressWarnings("unused") class MyTemplate { public int queryForInt(String sql, Object... params) { return 0; diff --git a/spring-aop/src/test/java/org/springframework/aop/framework/adapter/ThrowsAdviceInterceptorTests.java b/spring-aop/src/test/java/org/springframework/aop/framework/adapter/ThrowsAdviceInterceptorTests.java index 633705f068..e13097c4b6 100644 --- a/spring-aop/src/test/java/org/springframework/aop/framework/adapter/ThrowsAdviceInterceptorTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/framework/adapter/ThrowsAdviceInterceptorTests.java @@ -144,7 +144,7 @@ public final class ThrowsAdviceInterceptorTests { } @SuppressWarnings("serial") - private static class MyThrowsHandler extends MethodCounter implements ThrowsAdvice { + static class MyThrowsHandler extends MethodCounter implements ThrowsAdvice { // Full method signature public void afterThrowing(Method m, Object[] args, Object target, IOException ex) { count("ioException"); diff --git a/spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/AbstractBeanConfigurerTests.java b/spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/AbstractBeanConfigurerTests.java index 6ff04cf7b8..054c99f3e3 100644 --- a/spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/AbstractBeanConfigurerTests.java +++ b/spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/AbstractBeanConfigurerTests.java @@ -304,7 +304,7 @@ public abstract class AbstractBeanConfigurerTests extends TestCase { // } // } - + @SuppressWarnings("unused") private static class ShouldNotBeConfiguredBySpring { private String name; @@ -335,6 +335,7 @@ public abstract class AbstractBeanConfigurerTests extends TestCase { @Configurable + @SuppressWarnings("unused") private static class ShouldBeConfiguredBySpringUsingTypeNameAsBeanName { private String name; @@ -350,6 +351,7 @@ public abstract class AbstractBeanConfigurerTests extends TestCase { @Configurable(autowire=Autowire.BY_TYPE) + @SuppressWarnings("unused") private static class ShouldBeConfiguredBySpringUsingAutowireByType { private TestBean friend = null; @@ -365,6 +367,7 @@ public abstract class AbstractBeanConfigurerTests extends TestCase { @Configurable(autowire=Autowire.BY_NAME) + @SuppressWarnings("unused") private static class ValidAutowireByName { private TestBean friend = null; @@ -380,6 +383,7 @@ public abstract class AbstractBeanConfigurerTests extends TestCase { @Configurable(autowire=Autowire.BY_NAME, dependencyCheck=true) + @SuppressWarnings("unused") private static class InvalidAutowireByName { private TestBean friend; @@ -393,7 +397,7 @@ public abstract class AbstractBeanConfigurerTests extends TestCase { } } - + @SuppressWarnings("unused") private static class ArbitraryExistingPojo { private TestBean friend; @@ -426,6 +430,7 @@ public abstract class AbstractBeanConfigurerTests extends TestCase { @Configurable + @SuppressWarnings("unused") private static class BaseBean { public int setterCount; @@ -447,7 +452,7 @@ public abstract class AbstractBeanConfigurerTests extends TestCase { } @Configurable - @SuppressWarnings("serial") + @SuppressWarnings({"serial", "unused"}) private static class BaseSerializableBean implements Serializable { public int setterCount; @@ -467,6 +472,7 @@ public abstract class AbstractBeanConfigurerTests extends TestCase { @Aspect + @SuppressWarnings("unused") private static class WireArbitraryExistingPojo extends AbstractBeanConfigurerAspect { @Pointcut("initialization(ArbitraryExistingPojo.new(..)) && this(beanInstance)") @@ -477,6 +483,7 @@ public abstract class AbstractBeanConfigurerTests extends TestCase { @Aspect + @SuppressWarnings("unused") private static class AspectThatWillNotBeUsed extends AbstractBeanConfigurerAspect { @Pointcut("initialization(ClassThatWillNotActuallyBeWired.new(..)) && this(beanInstance)") diff --git a/spring-beans/src/test/java/org/springframework/beans/BeanUtilsTests.java b/spring-beans/src/test/java/org/springframework/beans/BeanUtilsTests.java index 9d53409e73..b35e6aabf7 100644 --- a/spring-beans/src/test/java/org/springframework/beans/BeanUtilsTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/BeanUtilsTests.java @@ -267,6 +267,7 @@ public final class BeanUtilsTests { } + @SuppressWarnings("unused") private static class NameAndSpecialProperty { private String name; @@ -291,6 +292,7 @@ public final class BeanUtilsTests { } + @SuppressWarnings("unused") private static class ContainerBean { private ContainedBean[] containedBeans; @@ -305,6 +307,7 @@ public final class BeanUtilsTests { } + @SuppressWarnings("unused") private static class ContainedBean { private String name; @@ -319,6 +322,7 @@ public final class BeanUtilsTests { } + @SuppressWarnings("unused") private static class MethodSignatureBean { public void doSomething() { diff --git a/spring-beans/src/test/java/org/springframework/beans/BeanWrapperGenericsTests.java b/spring-beans/src/test/java/org/springframework/beans/BeanWrapperGenericsTests.java index 3d310bdc68..88f647850d 100644 --- a/spring-beans/src/test/java/org/springframework/beans/BeanWrapperGenericsTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/BeanWrapperGenericsTests.java @@ -497,6 +497,7 @@ public class BeanWrapperGenericsTests { } + @SuppressWarnings("unused") private static class NestedGenericCollectionBean extends BaseGenericCollectionBean { private Map mapOfInteger; @@ -544,6 +545,7 @@ public class BeanWrapperGenericsTests { } + @SuppressWarnings("unused") private static class ComplexMapHolder { private Map, List> genericMap; diff --git a/spring-beans/src/test/java/org/springframework/beans/BeanWrapperTests.java b/spring-beans/src/test/java/org/springframework/beans/BeanWrapperTests.java index 9d4e022a64..9ec9af033b 100644 --- a/spring-beans/src/test/java/org/springframework/beans/BeanWrapperTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/BeanWrapperTests.java @@ -1569,6 +1569,7 @@ public final class BeanWrapperTests { } + @SuppressWarnings("unused") private static class Foo { private List list; @@ -1598,6 +1599,7 @@ public final class BeanWrapperTests { } + @SuppressWarnings("unused") private static class NoRead { public void setAge(int age) { @@ -1605,6 +1607,7 @@ public final class BeanWrapperTests { } + @SuppressWarnings("unused") private static class EnumTester { private Autowire autowire; @@ -1619,6 +1622,7 @@ public final class BeanWrapperTests { } + @SuppressWarnings("unused") private static class PropsTester { private Properties props; @@ -1647,6 +1651,7 @@ public final class BeanWrapperTests { } + @SuppressWarnings("unused") private static class GetterBean { private String name; @@ -1664,6 +1669,7 @@ public final class BeanWrapperTests { } + @SuppressWarnings("unused") private static class ThrowsException { public void doSomething(Throwable t) throws Throwable { @@ -1672,6 +1678,7 @@ public final class BeanWrapperTests { } + @SuppressWarnings("unused") private static class PrimitiveArrayBean { private int[] array; @@ -1686,6 +1693,7 @@ public final class BeanWrapperTests { } + @SuppressWarnings("unused") private static class NumberPropertyBean { private byte myPrimitiveByte; @@ -1804,6 +1812,7 @@ public final class BeanWrapperTests { } + @SuppressWarnings("unused") private static class IntelliBean { public void setName(String name) {} @@ -1818,6 +1827,7 @@ public final class BeanWrapperTests { } + @SuppressWarnings("unused") private static class Employee extends TestBean { private String co; diff --git a/spring-beans/src/test/java/org/springframework/beans/ConcurrentBeanWrapperTests.java b/spring-beans/src/test/java/org/springframework/beans/ConcurrentBeanWrapperTests.java index 95c3fbb8cc..2d98f138ba 100644 --- a/spring-beans/src/test/java/org/springframework/beans/ConcurrentBeanWrapperTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/ConcurrentBeanWrapperTests.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. @@ -135,6 +135,7 @@ public final class ConcurrentBeanWrapperTests { } + @SuppressWarnings("unused") private static class TestBean { private Properties properties; diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java index fc4ac5d55c..59141704b7 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java @@ -2334,6 +2334,7 @@ public class DefaultListableBeanFactoryTests { this.spouse = spouse; } + @SuppressWarnings("unused") private ConstructorDependency(TestBean spouse, TestBean otherSpouse) { throw new IllegalArgumentException("Should never be called"); } @@ -2560,6 +2561,7 @@ public class DefaultListableBeanFactoryTests { /** * Bean with a dependency on a {@link FactoryBean}. */ + @SuppressWarnings("unused") private static class FactoryBeanDependentBean { private FactoryBean factoryBean; @@ -2646,6 +2648,7 @@ public class DefaultListableBeanFactoryTests { } + @SuppressWarnings("unused") private static class TestSecuredBean { private String userName; @@ -2675,6 +2678,7 @@ public class DefaultListableBeanFactoryTests { } } + @SuppressWarnings("unused") private static class KnowsIfInstantiated { private static boolean instantiated; diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/parsing/CustomProblemReporterTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/parsing/CustomProblemReporterTests.java index 20bdd50654..cc009917fd 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/parsing/CustomProblemReporterTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/parsing/CustomProblemReporterTests.java @@ -91,10 +91,6 @@ public final class CustomProblemReporterTests { System.out.println(problem); this.warnings.add(problem); } - - public Problem[] getWarnings() { - return this.warnings.toArray(new Problem[this.warnings.size()]); - } } } diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/support/QualifierAnnotationAutowireBeanFactoryTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/support/QualifierAnnotationAutowireBeanFactoryTests.java index 195ad77529..cb7cf5580b 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/support/QualifierAnnotationAutowireBeanFactoryTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/support/QualifierAnnotationAutowireBeanFactoryTests.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. @@ -208,6 +208,7 @@ public class QualifierAnnotationAutowireBeanFactoryTests { } + @SuppressWarnings("unused") private static class QualifiedTestBean { @TestQualifier @@ -226,6 +227,7 @@ public class QualifierAnnotationAutowireBeanFactoryTests { } + @SuppressWarnings("unused") private static class Person { private String name; diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/support/security/CallbacksSecurityTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/support/security/CallbacksSecurityTests.java index 65e380d3e2..249c5bac02 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/support/security/CallbacksSecurityTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/support/security/CallbacksSecurityTests.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. @@ -75,6 +75,7 @@ public class CallbacksSecurityTests { private DefaultListableBeanFactory beanFactory; private SecurityContextProvider provider; + @SuppressWarnings("unused") private static class NonPrivilegedBean { private String expectedName; @@ -117,6 +118,7 @@ public class CallbacksSecurityTests { } } + @SuppressWarnings("unused") private static class NonPrivilegedSpringCallbacksBean implements InitializingBean, DisposableBean, BeanClassLoaderAware, BeanFactoryAware, BeanNameAware { @@ -161,6 +163,7 @@ public class CallbacksSecurityTests { } } + @SuppressWarnings("unused") private static class NonPrivilegedFactoryBean implements SmartFactoryBean { private String expectedName; @@ -204,6 +207,7 @@ public class CallbacksSecurityTests { } } + @SuppressWarnings("unused") private static class NonPrivilegedFactory { private final String expectedName; diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/FactoryMethods.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/FactoryMethods.java index a5ef87cb1f..ba8c74bfe9 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/FactoryMethods.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/FactoryMethods.java @@ -62,6 +62,7 @@ public class FactoryMethods { return new FactoryMethods(tb, null, num); } + @SuppressWarnings("unused") private static List listInstance() { return Collections.EMPTY_LIST; } @@ -99,6 +100,7 @@ public class FactoryMethods { return this.tb; } + @SuppressWarnings("unused") private TestBean privateGetTestBean() { return this.tb; } diff --git a/spring-beans/src/test/java/org/springframework/beans/propertyeditors/CustomCollectionEditorTests.java b/spring-beans/src/test/java/org/springframework/beans/propertyeditors/CustomCollectionEditorTests.java index 14b3f4d48d..4f9463a5c7 100644 --- a/spring-beans/src/test/java/org/springframework/beans/propertyeditors/CustomCollectionEditorTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/propertyeditors/CustomCollectionEditorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 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. @@ -85,7 +85,7 @@ public final class CustomCollectionEditorTests { } - @SuppressWarnings("serial") + @SuppressWarnings({ "serial", "unused" }) private static final class CollectionTypeWithNoNoArgCtor extends ArrayList { public CollectionTypeWithNoNoArgCtor(String anArg) { } diff --git a/spring-beans/src/test/java/org/springframework/beans/propertyeditors/CustomEditorTests.java b/spring-beans/src/test/java/org/springframework/beans/propertyeditors/CustomEditorTests.java index d205291620..af590e3936 100644 --- a/spring-beans/src/test/java/org/springframework/beans/propertyeditors/CustomEditorTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/propertyeditors/CustomEditorTests.java @@ -1506,6 +1506,7 @@ public class CustomEditorTests { } + @SuppressWarnings("unused") private static class PrimitiveArrayBean { private byte[] byteArray; @@ -1530,6 +1531,7 @@ public class CustomEditorTests { } + @SuppressWarnings("unused") private static class CharBean { private char myChar; @@ -1554,6 +1556,7 @@ public class CustomEditorTests { } + @SuppressWarnings("unused") private static class OldCollectionsBean { private Vector vector; diff --git a/spring-beans/src/test/java/org/springframework/beans/support/PropertyComparatorTests.java b/spring-beans/src/test/java/org/springframework/beans/support/PropertyComparatorTests.java index 320759d1b8..ad1666fcd1 100644 --- a/spring-beans/src/test/java/org/springframework/beans/support/PropertyComparatorTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/support/PropertyComparatorTests.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. @@ -96,6 +96,7 @@ public class PropertyComparatorTests { } + @SuppressWarnings("unused") private static class Dog implements Comparable { private String nickName; diff --git a/spring-context/src/test/java/org/springframework/aop/framework/CglibProxyTests.java b/spring-context/src/test/java/org/springframework/aop/framework/CglibProxyTests.java index 9b423759f7..2330909eec 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/CglibProxyTests.java +++ b/spring-context/src/test/java/org/springframework/aop/framework/CglibProxyTests.java @@ -137,10 +137,13 @@ public final class CglibProxyTests extends AbstractAopProxyTests implements Seri @Test public void testCglibProxyingGivesMeaningfulExceptionIfAskedToProxyNonvisibleClass() { + + @SuppressWarnings("unused") class YouCantSeeThis { void hidden() { } } + YouCantSeeThis mine = new YouCantSeeThis(); try { ProxyFactory pf = new ProxyFactory(mine); diff --git a/spring-context/src/test/java/org/springframework/beans/factory/support/InjectAnnotationAutowireContextTests.java b/spring-context/src/test/java/org/springframework/beans/factory/support/InjectAnnotationAutowireContextTests.java index d7cf863def..3544595d9d 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/support/InjectAnnotationAutowireContextTests.java +++ b/spring-context/src/test/java/org/springframework/beans/factory/support/InjectAnnotationAutowireContextTests.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. @@ -608,6 +608,7 @@ public class InjectAnnotationAutowireContextTests { } + @SuppressWarnings("unused") private static class QualifiedFieldWithBaseQualifierDefaultValueTestBean { @Inject diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/QualifierAnnotationTests.java b/spring-context/src/test/java/org/springframework/beans/factory/xml/QualifierAnnotationTests.java index 91d1d7565a..5271e47915 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/QualifierAnnotationTests.java +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/QualifierAnnotationTests.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. @@ -199,6 +199,7 @@ public final class QualifierAnnotationTests { } + @SuppressWarnings("unused") private static class NonQualifiedTestBean { @Autowired @@ -305,6 +306,7 @@ public final class QualifierAnnotationTests { } + @SuppressWarnings("unused") private static class QualifiedByAttributesTestBean { @Autowired @MultipleAttributeQualifier(name="moe", age=42) @@ -323,6 +325,7 @@ public final class QualifierAnnotationTests { } + @SuppressWarnings("unused") private static class Person { private String name; 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 6f68b6bf60..a5bc212ced 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 @@ -198,7 +198,7 @@ abstract class ConstructorInjectedOverrides { * @author Juergen Hoeller * @since 09.11.2003 */ -@SuppressWarnings("serial") +@SuppressWarnings({ "serial", "unused" }) class DerivedConstructorDependenciesBean extends ConstructorDependenciesBean { boolean initialized; @@ -332,6 +332,7 @@ class DummyReferencer { * @author Rod Johnson * @author Juergen Hoeller */ +@SuppressWarnings("unused") class FactoryMethods { public static FactoryMethods nullInstance() { diff --git a/spring-context/src/test/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessorTests.java b/spring-context/src/test/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessorTests.java index 331a2f0af2..e2c1cc3b57 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessorTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessorTests.java @@ -700,6 +700,7 @@ public class CommonAnnotationBeanPostProcessorTests { } + @SuppressWarnings("unused") private static class NullFactory { public static Object create() { diff --git a/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanParserBeanDefinitionDefaultsTests.java b/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanParserBeanDefinitionDefaultsTests.java index 28fdcccca0..bf0baeaa53 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanParserBeanDefinitionDefaultsTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanParserBeanDefinitionDefaultsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 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. @@ -214,6 +214,7 @@ public class ComponentScanParserBeanDefinitionDefaultsTests { } + @SuppressWarnings("unused") private static class DefaultsTestBean { static int INIT_COUNT; @@ -276,6 +277,7 @@ public class ComponentScanParserBeanDefinitionDefaultsTests { } + @SuppressWarnings("unused") private static class PropertyDependencyTestBean { private String name; @@ -290,6 +292,7 @@ public class ComponentScanParserBeanDefinitionDefaultsTests { } + @SuppressWarnings("unused") private static class ConstructorDependencyTestBean { private String name; diff --git a/spring-context/src/test/java/org/springframework/context/annotation/configuration/ConfigurationClassProcessingTests.java b/spring-context/src/test/java/org/springframework/context/annotation/configuration/ConfigurationClassProcessingTests.java index 54846f4133..7e11066fe8 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/configuration/ConfigurationClassProcessingTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/configuration/ConfigurationClassProcessingTests.java @@ -272,6 +272,7 @@ public class ConfigurationClassProcessingTests { } + @SuppressWarnings("unused") static class ConfigWithPostProcessor extends ConfigWithPrototypeBean { @Value("${myProp}") @@ -280,10 +281,13 @@ public class ConfigurationClassProcessingTests { @Bean public POBPP beanPostProcessor() { return new POBPP() { + String nameSuffix = "-processed-" + myProp; + public void setNameSuffix(String nameSuffix) { this.nameSuffix = nameSuffix; } + @Override public Object postProcessBeforeInitialization(Object bean, String beanName) { if (bean instanceof ITestBean) { @@ -291,10 +295,12 @@ public class ConfigurationClassProcessingTests { } return bean; } + @Override public Object postProcessAfterInitialization(Object bean, String beanName) { return bean; } + public int getOrder() { return 0; } diff --git a/spring-context/src/test/java/org/springframework/jmx/JmxTestBean.java b/spring-context/src/test/java/org/springframework/jmx/JmxTestBean.java index d42fbf201b..b1a773128d 100644 --- a/spring-context/src/test/java/org/springframework/jmx/JmxTestBean.java +++ b/spring-context/src/test/java/org/springframework/jmx/JmxTestBean.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. You may obtain a copy of @@ -138,12 +138,14 @@ public class JmxTestBean implements IJmxTestBean { protected void someProtectedMethod() { } + @SuppressWarnings("unused") private void somePrivateMethod() { } protected void getSomething() { } + @SuppressWarnings("unused") private void getSomethingElse() { } diff --git a/spring-context/src/test/java/org/springframework/validation/DataBinderTests.java b/spring-context/src/test/java/org/springframework/validation/DataBinderTests.java index 515a1013b0..77fc0dee24 100644 --- a/spring-context/src/test/java/org/springframework/validation/DataBinderTests.java +++ b/spring-context/src/test/java/org/springframework/validation/DataBinderTests.java @@ -1630,6 +1630,7 @@ public class DataBinderTests extends TestCase { } + @SuppressWarnings("unused") private static class BeanWithIntegerList { private List integerList; @@ -1644,6 +1645,7 @@ public class DataBinderTests extends TestCase { } + @SuppressWarnings("unused") private static class Book { private String Title; @@ -1728,6 +1730,7 @@ public class DataBinderTests extends TestCase { } + @SuppressWarnings("unused") private static class GrowingList extends AbstractList { private List list; diff --git a/spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java b/spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java index 9b2f8493b6..89e8b69be4 100644 --- a/spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java +++ b/spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.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. @@ -658,6 +658,7 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol /** * VFS visitor for path matching purposes. */ + @SuppressWarnings("unused") private static class PatternVirtualFileVisitor implements InvocationHandler { private final String subPattern; diff --git a/spring-core/src/test/java/org/springframework/core/BridgeMethodResolverTests.java b/spring-core/src/test/java/org/springframework/core/BridgeMethodResolverTests.java index c013f3d3db..dbca8b7b5b 100644 --- a/spring-core/src/test/java/org/springframework/core/BridgeMethodResolverTests.java +++ b/spring-core/src/test/java/org/springframework/core/BridgeMethodResolverTests.java @@ -560,6 +560,7 @@ public class BridgeMethodResolverTests { } + @SuppressWarnings("unused") private static class StringGenericParameter implements GenericParameter { @Override @@ -1163,6 +1164,7 @@ public class BridgeMethodResolverTests { } + @SuppressWarnings("unused") private static class MegaMessageProducerImpl extends Other implements MegaMessageProducer { public void receive(NewMegaMessageEvent event) { @@ -1198,6 +1200,7 @@ public class BridgeMethodResolverTests { } + @SuppressWarnings("unused") private static abstract class AbstractImplementsInterface implements IGenericInterface { @Override diff --git a/spring-core/src/test/java/org/springframework/core/type/AnnotationTypeFilterTests.java b/spring-core/src/test/java/org/springframework/core/type/AnnotationTypeFilterTests.java index e9d8c1e19d..b316d1749e 100644 --- a/spring-core/src/test/java/org/springframework/core/type/AnnotationTypeFilterTests.java +++ b/spring-core/src/test/java/org/springframework/core/type/AnnotationTypeFilterTests.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. @@ -122,10 +122,12 @@ public class AnnotationTypeFilterTests { } + @SuppressWarnings("unused") private static class SomeSubClassOfSomeComponentInterface implements SomeComponentInterface { } + @SuppressWarnings("unused") private static class SomeSubClassOfSomeComponent extends SomeComponent { } @@ -139,10 +141,12 @@ public class AnnotationTypeFilterTests { } + @SuppressWarnings("unused") private static class SomeSubclassOfSomeClassMarkedWithNonInheritedAnnotation extends SomeClassMarkedWithNonInheritedAnnotation { } + @SuppressWarnings("unused") private static class SomeNonCandidateClass { } diff --git a/spring-core/src/test/java/org/springframework/core/type/AssignableTypeFilterTests.java b/spring-core/src/test/java/org/springframework/core/type/AssignableTypeFilterTests.java index 0ca007ea2e..cc624af1b8 100644 --- a/spring-core/src/test/java/org/springframework/core/type/AssignableTypeFilterTests.java +++ b/spring-core/src/test/java/org/springframework/core/type/AssignableTypeFilterTests.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. @@ -81,6 +81,7 @@ public class AssignableTypeFilterTests extends TestCase { } + @SuppressWarnings("unused") private static class TestInterfaceImpl implements TestInterface { } @@ -89,6 +90,7 @@ public class AssignableTypeFilterTests extends TestCase { } + @SuppressWarnings("unused") private static class SomeDaoLikeImpl extends SimpleJdbcDaoSupport implements SomeDaoLikeInterface { } diff --git a/spring-core/src/test/java/org/springframework/util/ClassUtilsTests.java b/spring-core/src/test/java/org/springframework/util/ClassUtilsTests.java index f4078360de..ce187d7c71 100644 --- a/spring-core/src/test/java/org/springframework/util/ClassUtilsTests.java +++ b/spring-core/src/test/java/org/springframework/util/ClassUtilsTests.java @@ -308,19 +308,25 @@ public class ClassUtilsTests extends TestCase { } } + @SuppressWarnings("unused") private static class OverloadedMethodsClass { + public void print(String messages) { /* no-op */ } + public void print(String[] messages) { /* no-op */ } } - private static class SubOverloadedMethodsClass extends OverloadedMethodsClass{ + @SuppressWarnings("unused") + private static class SubOverloadedMethodsClass extends OverloadedMethodsClass { + public void print(String header, String[] messages) { /* no-op */ } + void print(String header, String[] messages, String footer) { /* no-op */ } diff --git a/spring-core/src/test/java/org/springframework/util/MethodInvokerTests.java b/spring-core/src/test/java/org/springframework/util/MethodInvokerTests.java index 2fa0245aa1..679ab9566e 100644 --- a/spring-core/src/test/java/org/springframework/util/MethodInvokerTests.java +++ b/spring-core/src/test/java/org/springframework/util/MethodInvokerTests.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. @@ -191,6 +191,7 @@ public class MethodInvokerTests extends TestCase { } + @SuppressWarnings("unused") public static class Greeter { // should handle Salesman (only interface) diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/GenericTableMetaDataProvider.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/GenericTableMetaDataProvider.java index 138518660a..8eb1e1ea5a 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/GenericTableMetaDataProvider.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/GenericTableMetaDataProvider.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. @@ -310,7 +310,6 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider { tmd.setCatalogName(tables.getString("TABLE_CAT")); tmd.setSchemaName(tables.getString("TABLE_SCHEM")); tmd.setTableName(tables.getString("TABLE_NAME")); - tmd.setType(tables.getString("TABLE_TYPE")); if (tmd.getSchemaName() == null) { tableMeta.put(userName != null ? userName.toUpperCase() : "", tmd); } @@ -445,7 +444,6 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider { private String tableName; - private String type; public void setCatalogName(String catalogName) { this.catalogName = catalogName; @@ -470,14 +468,6 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider { public String getTableName() { return this.tableName; } - - public void setType(String type) { - this.type = type; - } - - public String getType() { - return this.type; - } } } diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/DataSourceTransactionManager.java b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/DataSourceTransactionManager.java index 9c6ebcfde2..b0e9811e3a 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/DataSourceTransactionManager.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/DataSourceTransactionManager.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. @@ -348,10 +348,6 @@ public class DataSourceTransactionManager extends AbstractPlatformTransactionMan return this.newConnectionHolder; } - public boolean hasTransaction() { - return (getConnectionHolder() != null && getConnectionHolder().isTransactionActive()); - } - public void setMustRestoreAutoCommit(boolean mustRestoreAutoCommit) { this.mustRestoreAutoCommit = mustRestoreAutoCommit; } diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/core/namedparam/BeanPropertySqlParameterSourceTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/core/namedparam/BeanPropertySqlParameterSourceTests.java index a684629973..15b0e21933 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/core/namedparam/BeanPropertySqlParameterSourceTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/core/namedparam/BeanPropertySqlParameterSourceTests.java @@ -81,6 +81,8 @@ public class BeanPropertySqlParameterSourceTests { assertFalse(source.hasValue("noOp")); } + + @SuppressWarnings("unused") private static final class NoReadableProperties { public void setNoOp(String noOp) { diff --git a/spring-jms/src/test/java/org/springframework/jms/listener/endpoint/DefaultJmsActivationSpecFactoryTests.java b/spring-jms/src/test/java/org/springframework/jms/listener/endpoint/DefaultJmsActivationSpecFactoryTests.java index 598c5ada29..f91da0b40c 100644 --- a/spring-jms/src/test/java/org/springframework/jms/listener/endpoint/DefaultJmsActivationSpecFactoryTests.java +++ b/spring-jms/src/test/java/org/springframework/jms/listener/endpoint/DefaultJmsActivationSpecFactoryTests.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. @@ -20,8 +20,8 @@ import javax.jms.Destination; import javax.jms.Session; import junit.framework.TestCase; -import org.easymock.MockControl; +import org.easymock.MockControl; import org.springframework.jca.StubResourceAdapter; import org.springframework.jms.StubQueue; import org.springframework.jms.support.destination.DestinationResolver; @@ -89,6 +89,7 @@ public class DefaultJmsActivationSpecFactoryTests extends TestCase { } + @SuppressWarnings("unused") private static class StubActiveMQActivationSpec extends StubJmsActivationSpec { private int maxSessions; @@ -133,6 +134,7 @@ public class DefaultJmsActivationSpecFactoryTests extends TestCase { } + @SuppressWarnings("unused") private static class StubWebSphereActivationSpecImpl extends StubJmsActivationSpec { private Destination destination; diff --git a/spring-orm/src/test/java/org/springframework/orm/jdo/JdoInterceptorTests.java b/spring-orm/src/test/java/org/springframework/orm/jdo/JdoInterceptorTests.java index c88e58cd07..1967c188d5 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jdo/JdoInterceptorTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jdo/JdoInterceptorTests.java @@ -77,6 +77,7 @@ public class JdoInterceptorTests { } + @SuppressWarnings("unused") private static class TestInvocation implements MethodInvocation { private PersistenceManagerFactory persistenceManagerFactory; diff --git a/spring-orm/src/test/java/org/springframework/orm/jpa/JpaInterceptorTests.java b/spring-orm/src/test/java/org/springframework/orm/jpa/JpaInterceptorTests.java index acc8f3b555..959fa0efe9 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jpa/JpaInterceptorTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jpa/JpaInterceptorTests.java @@ -198,6 +198,7 @@ public class JpaInterceptorTests { } + @SuppressWarnings("unused") private static class TestInvocation implements MethodInvocation { private EntityManagerFactory entityManagerFactory; diff --git a/spring-oxm/src/test/java/org/springframework/oxm/jaxb/Jaxb2MarshallerTests.java b/spring-oxm/src/test/java/org/springframework/oxm/jaxb/Jaxb2MarshallerTests.java index 3d7a497867..43101e62d0 100644 --- a/spring-oxm/src/test/java/org/springframework/oxm/jaxb/Jaxb2MarshallerTests.java +++ b/spring-oxm/src/test/java/org/springframework/oxm/jaxb/Jaxb2MarshallerTests.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. @@ -311,10 +311,12 @@ public class Jaxb2MarshallerTests extends AbstractMarshallerTests { private String s = "Hello"; } + @SuppressWarnings("unused") private JAXBElement createDummyRootElement() { return null; } + @SuppressWarnings("unused") private JAXBElement createDummyType() { return null; } diff --git a/spring-test/src/main/java/org/springframework/test/jpa/AbstractJpaTests.java b/spring-test/src/main/java/org/springframework/test/jpa/AbstractJpaTests.java index ba959d162f..005c19e3d8 100644 --- a/spring-test/src/main/java/org/springframework/test/jpa/AbstractJpaTests.java +++ b/spring-test/src/main/java/org/springframework/test/jpa/AbstractJpaTests.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. @@ -326,6 +326,7 @@ public abstract class AbstractJpaTests extends AbstractAnnotationAwareTransactio private final LoadTimeWeaver ltw; + @SuppressWarnings("unused") public LoadTimeWeaverInjectingBeanPostProcessor(LoadTimeWeaver ltw) { this.ltw = ltw; } @@ -346,6 +347,7 @@ public abstract class AbstractJpaTests extends AbstractAnnotationAwareTransactio private final ClassLoader shadowingClassLoader; + @SuppressWarnings("unused") public ShadowingLoadTimeWeaver(ClassLoader shadowingClassLoader) { this.shadowingClassLoader = shadowingClassLoader; } diff --git a/spring-web/src/test/java/org/springframework/web/multipart/commons/CommonsMultipartResolverTests.java b/spring-web/src/test/java/org/springframework/web/multipart/commons/CommonsMultipartResolverTests.java index 29df40fbf3..b264a44613 100644 --- a/spring-web/src/test/java/org/springframework/web/multipart/commons/CommonsMultipartResolverTests.java +++ b/spring-web/src/test/java/org/springframework/web/multipart/commons/CommonsMultipartResolverTests.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. @@ -465,19 +465,11 @@ public class CommonsMultipartResolverTests { this.writtenFile = file; } - public File getWrittenFile() { - return writtenFile; - } - @Override public void delete() { this.deleted = true; } - public boolean isDeleted() { - return deleted; - } - @Override public String getFieldName() { return fieldName; From 065b1c0e463e0d2b63931d487a6e29ef7c99b189 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Fri, 25 Jan 2013 14:33:23 -0800 Subject: [PATCH 3/5] Fix unused local variable warnings --- .../aspectj/AbstractTransactionAspect.aj | 2 +- .../aspectj/AbstractBeanConfigurerTests.java | 1 + .../config/CustomScopeConfigurerTests.java | 3 +-- .../PropertyResourceConfigurerTests.java | 2 ++ .../security/CallbacksSecurityTests.java | 3 +-- .../factory/xml/AbstractBeanFactoryTests.java | 9 +++++---- .../assembler/AbstractJmxAssemblerTests.java | 4 +++- ...faceBasedMBeanInfoAssemblerMappedTests.java | 6 +++--- .../core/enums/LabeledEnumTests.java | 7 ++++--- .../springframework/util/StopWatchTests.java | 6 +++--- .../expression/spel/MapAccessTests.java | 8 +++++--- .../spel/SpelDocumentationTests.java | 5 ++++- .../expression/spel/SpelReproTests.java | 5 +++++ .../SQLStateExceptionTranslatorTests.java | 3 +-- .../jms/core/JmsTemplate102Tests.java | 8 ++++---- .../jms/core/JmsTemplateTests.java | 18 +++++++++--------- ...onManagedEntityManagerIntegrationTests.java | 3 ++- .../AbstractTransactionAspectTests.java | 2 +- .../BeanFactoryTransactionTests.java | 3 ++- ...StreamingSimpleHttpRequestFactoryTests.java | 4 ++-- .../ResponseStatusExceptionResolverTests.java | 2 +- .../MultiActionControllerTests.java | 5 +++-- .../view/ResourceBundleViewResolverTests.java | 8 ++++---- ...tionScannerJsr330ScopeIntegrationTests.java | 3 ++- 24 files changed, 69 insertions(+), 51 deletions(-) diff --git a/spring-aspects/src/main/java/org/springframework/transaction/aspectj/AbstractTransactionAspect.aj b/spring-aspects/src/main/java/org/springframework/transaction/aspectj/AbstractTransactionAspect.aj index 3ce264d9e1..54bd4ef746 100644 --- a/spring-aspects/src/main/java/org/springframework/transaction/aspectj/AbstractTransactionAspect.aj +++ b/spring-aspects/src/main/java/org/springframework/transaction/aspectj/AbstractTransactionAspect.aj @@ -60,7 +60,7 @@ public abstract aspect AbstractTransactionAspect extends TransactionAspectSuppor before(Object txObject) : transactionalMethodExecution(txObject) { MethodSignature methodSignature = (MethodSignature) thisJoinPoint.getSignature(); Method method = methodSignature.getMethod(); - TransactionInfo txInfo = createTransactionIfNecessary(method, txObject.getClass()); + createTransactionIfNecessary(method, txObject.getClass()); } @SuppressAjWarnings("adviceDidNotMatch") diff --git a/spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/AbstractBeanConfigurerTests.java b/spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/AbstractBeanConfigurerTests.java index 054c99f3e3..71a10afcaf 100644 --- a/spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/AbstractBeanConfigurerTests.java +++ b/spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/AbstractBeanConfigurerTests.java @@ -211,6 +211,7 @@ public abstract class AbstractBeanConfigurerTests extends TestCase { MailClientDependencyInjectionAspect.aspectOf().setMailSender(new JavaMailSenderImpl()); Order testOrder = new Order(); Order deserializedOrder = serializeAndDeserialize(testOrder); + assertNotNull(deserializedOrder); assertNotNull("Interface driven injection didn't occur for deserialization", testOrder.mailSender); } diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/config/CustomScopeConfigurerTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/config/CustomScopeConfigurerTests.java index 65e6debd15..f06388cc8d 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/config/CustomScopeConfigurerTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/config/CustomScopeConfigurerTests.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. @@ -45,7 +45,6 @@ public final class CustomScopeConfigurerTests { @Test public void testWithNoScopes() throws Exception { - Scope scope = mock(Scope.class); CustomScopeConfigurer figurer = new CustomScopeConfigurer(); figurer.postProcessBeanFactory(factory); } diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyResourceConfigurerTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyResourceConfigurerTests.java index 1212913cb1..fab64afdcb 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyResourceConfigurerTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyResourceConfigurerTests.java @@ -17,6 +17,7 @@ package org.springframework.beans.factory.config; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; @@ -644,6 +645,7 @@ public final class PropertyResourceConfigurerTests { ppc.postProcessBeanFactory(factory); TestBean tb = (TestBean) factory.getBean("tb"); + assertNotNull(tb); assertEquals(0, factory.getAliases("tb").length); } diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/support/security/CallbacksSecurityTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/support/security/CallbacksSecurityTests.java index 249c5bac02..c8c6595e45 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/support/security/CallbacksSecurityTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/support/security/CallbacksSecurityTests.java @@ -515,8 +515,7 @@ public class CallbacksSecurityTests { perms.add(new AuthPermission("getSubject")); ProtectionDomain pd = new ProtectionDomain(null, perms); - AccessControlContext acc = new AccessControlContext( - new ProtectionDomain[] { pd }); + new AccessControlContext(new ProtectionDomain[] { pd }); final Subject subject = new Subject(); subject.getPrincipals().add(new TestPrincipal("user1")); diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/AbstractBeanFactoryTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/AbstractBeanFactoryTests.java index 4510487801..3d88251b7e 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/AbstractBeanFactoryTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/AbstractBeanFactoryTests.java @@ -121,7 +121,7 @@ public abstract class AbstractBeanFactoryTests extends TestCase { public void testGetInstanceByNonmatchingClass() { try { - Object o = getBeanFactory().getBean("rod", BeanFactory.class); + getBeanFactory().getBean("rod", BeanFactory.class); fail("Rod bean is not of type BeanFactory; getBeanInstance(rod, BeanFactory.class) should throw BeanNotOfRequiredTypeException"); } catch (BeanNotOfRequiredTypeException ex) { @@ -155,7 +155,7 @@ public abstract class AbstractBeanFactoryTests extends TestCase { public void testGetSharedInstanceByNonmatchingClass() { try { - Object o = getBeanFactory().getBean("rod", BeanFactory.class); + getBeanFactory().getBean("rod", BeanFactory.class); fail("Rod bean is not of type BeanFactory; getBeanInstance(rod, BeanFactory.class) should throw BeanNotOfRequiredTypeException"); } catch (BeanNotOfRequiredTypeException ex) { @@ -199,7 +199,7 @@ public abstract class AbstractBeanFactoryTests extends TestCase { public void testNotThere() { assertFalse(getBeanFactory().containsBean("Mr Squiggle")); try { - Object o = getBeanFactory().getBean("Mr Squiggle"); + getBeanFactory().getBean("Mr Squiggle"); fail("Can't find missing bean"); } catch (BeansException ex) { @@ -223,7 +223,7 @@ public abstract class AbstractBeanFactoryTests extends TestCase { public void xtestTypeMismatch() { try { - Object o = getBeanFactory().getBean("typeMismatch"); + getBeanFactory().getBean("typeMismatch"); fail("Shouldn't succeed with type mismatch"); } catch (BeanCreationException wex) { @@ -278,6 +278,7 @@ public abstract class AbstractBeanFactoryTests extends TestCase { */ public void testFactoryIsInitialized() throws Exception { TestBean tb = (TestBean) getBeanFactory().getBean("singletonFactory"); + assertNotNull(tb); DummyFactory factory = (DummyFactory) getBeanFactory().getBean("&singletonFactory"); assertTrue("Factory was initialized because it implemented InitializingBean", factory.wasInitialized()); } diff --git a/spring-context/src/test/java/org/springframework/jmx/export/assembler/AbstractJmxAssemblerTests.java b/spring-context/src/test/java/org/springframework/jmx/export/assembler/AbstractJmxAssemblerTests.java index 59b71a58b2..2c4a06e0be 100644 --- a/spring-context/src/test/java/org/springframework/jmx/export/assembler/AbstractJmxAssemblerTests.java +++ b/spring-context/src/test/java/org/springframework/jmx/export/assembler/AbstractJmxAssemblerTests.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. You may obtain a copy of @@ -51,6 +51,7 @@ public abstract class AbstractJmxAssemblerTests extends AbstractJmxTests { public void testRegisterOperations() throws Exception { IJmxTestBean bean = getBean(); + assertNotNull(bean); MBeanInfo inf = getMBeanInfo(); assertEquals("Incorrect number of operations registered", getExpectedOperationCount(), inf.getOperations().length); @@ -58,6 +59,7 @@ public abstract class AbstractJmxAssemblerTests extends AbstractJmxTests { public void testRegisterAttributes() throws Exception { IJmxTestBean bean = getBean(); + assertNotNull(bean); MBeanInfo inf = getMBeanInfo(); assertEquals("Incorrect number of attributes registered", getExpectedAttributeCount(), inf.getAttributes().length); diff --git a/spring-context/src/test/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssemblerMappedTests.java b/spring-context/src/test/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssemblerMappedTests.java index dc9db0fc5e..5cd8488eb7 100644 --- a/spring-context/src/test/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssemblerMappedTests.java +++ b/spring-context/src/test/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssemblerMappedTests.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. @@ -39,7 +39,7 @@ public class InterfaceBasedMBeanInfoAssemblerMappedTests extends AbstractJmxAsse public void testWithUnknownClass() throws Exception { try { - InterfaceBasedMBeanInfoAssembler assembler = getWithMapping("com.foo.bar.Unknown"); + getWithMapping("com.foo.bar.Unknown"); fail("Should have thrown IllegalArgumentException"); } catch (IllegalArgumentException ex) { @@ -49,7 +49,7 @@ public class InterfaceBasedMBeanInfoAssemblerMappedTests extends AbstractJmxAsse public void testWithNonInterface() throws Exception { try { - InterfaceBasedMBeanInfoAssembler assembler = getWithMapping("JmxTestBean"); + getWithMapping("JmxTestBean"); fail("Should have thrown IllegalArgumentException"); } catch (IllegalArgumentException ex) { diff --git a/spring-core/src/test/java/org/springframework/core/enums/LabeledEnumTests.java b/spring-core/src/test/java/org/springframework/core/enums/LabeledEnumTests.java index 4bd9a3f182..de0fccf46b 100644 --- a/spring-core/src/test/java/org/springframework/core/enums/LabeledEnumTests.java +++ b/spring-core/src/test/java/org/springframework/core/enums/LabeledEnumTests.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. @@ -104,7 +104,7 @@ public class LabeledEnumTests extends TestCase { public void testDoesNotMatchWrongClass() { try { - LabeledEnum none = StaticLabeledEnumResolver.instance().getLabeledEnumByCode(Dog.class, + StaticLabeledEnumResolver.instance().getLabeledEnumByCode(Dog.class, new Short((short) 1)); fail("Should have failed"); } @@ -119,10 +119,11 @@ public class LabeledEnumTests extends TestCase { } - @SuppressWarnings("serial") + @SuppressWarnings({ "serial", "unused" }) private static class Other extends StaticLabeledEnum { public static final Other THING1 = new Other(1, "Thing1"); + public static final Other THING2 = new Other(2, "Thing2"); diff --git a/spring-core/src/test/java/org/springframework/util/StopWatchTests.java b/spring-core/src/test/java/org/springframework/util/StopWatchTests.java index e7d745d416..4170f55624 100644 --- a/spring-core/src/test/java/org/springframework/util/StopWatchTests.java +++ b/spring-core/src/test/java/org/springframework/util/StopWatchTests.java @@ -1,6 +1,6 @@ /* - * 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. @@ -34,7 +34,6 @@ public class StopWatchTests extends TestCase { String name1 = "Task 1"; String name2 = "Task 2"; - long fudgeFactor = 5L; assertFalse(sw.isRunning()); sw.start(name1); Thread.sleep(int1); @@ -44,6 +43,7 @@ public class StopWatchTests extends TestCase { // TODO are timings off in JUnit? Why do these assertions sometimes fail // under both Ant and Eclipse? + //long fudgeFactor = 5L; //assertTrue("Unexpected timing " + sw.getTotalTime(), sw.getTotalTime() >= int1); //assertTrue("Unexpected timing " + sw.getTotalTime(), sw.getTotalTime() <= int1 + fudgeFactor); sw.start(name2); @@ -72,7 +72,6 @@ public class StopWatchTests extends TestCase { String name1 = "Task 1"; String name2 = "Task 2"; - long fudgeFactor = 5L; assertFalse(sw.isRunning()); sw.start(name1); Thread.sleep(int1); @@ -82,6 +81,7 @@ public class StopWatchTests extends TestCase { // TODO are timings off in JUnit? Why do these assertions sometimes fail // under both Ant and Eclipse? + //long fudgeFactor = 5L; //assertTrue("Unexpected timing " + sw.getTotalTime(), sw.getTotalTime() >= int1); //assertTrue("Unexpected timing " + sw.getTotalTime(), sw.getTotalTime() <= int1 + fudgeFactor); sw.start(name2); diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/MapAccessTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/MapAccessTests.java index 3ea0f98e3d..6118c82af9 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/MapAccessTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/MapAccessTests.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. @@ -17,6 +17,7 @@ package org.springframework.expression.spel; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import java.util.HashMap; import java.util.Map; @@ -83,9 +84,10 @@ public class MapAccessTests extends ExpressionTestCase { ExpressionParser parser = new SpelExpressionParser(); Expression exp = parser.parseExpression("testBean.properties['key2']"); - String key= (String)exp.getValue(bean); + String key = (String) exp.getValue(bean); + assertNotNull(key); - } + } public static class TestBean { diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/SpelDocumentationTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/SpelDocumentationTests.java index 9416ba87cf..41261a4d7c 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/SpelDocumentationTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/SpelDocumentationTests.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. @@ -18,6 +18,7 @@ package org.springframework.expression.spel; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; @@ -213,9 +214,11 @@ public class SpelDocumentationTests extends ExpressionTestCase { societyContext.setRootObject(new IEEE()); // Officer's Dictionary Inventor pupin = parser.parseExpression("officers['president']").getValue(societyContext, Inventor.class); + assertNotNull(pupin); // evaluates to "Idvor" String city = parser.parseExpression("officers['president'].PlaceOfBirth.city").getValue(societyContext, String.class); + assertNotNull(city); // setting values Inventor i = parser.parseExpression("officers['advisors'][0]").getValue(societyContext,Inventor.class); diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/SpelReproTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/SpelReproTests.java index 765422302a..fdf04c7ba8 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/SpelReproTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/SpelReproTests.java @@ -19,6 +19,7 @@ package org.springframework.expression.spel; import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -1680,6 +1681,7 @@ public class SpelReproTests extends ExpressionTestCase { ExpressionParser parser = new SpelExpressionParser(); StandardEvaluationContext evaluationContext = new StandardEvaluationContext(new BooleanHolder()); Class valueType = parser.parseExpression("simpleProperty").getValueType(evaluationContext); + assertNotNull(valueType); } @Test @@ -1687,6 +1689,7 @@ public class SpelReproTests extends ExpressionTestCase { ExpressionParser parser = new SpelExpressionParser(); StandardEvaluationContext evaluationContext = new StandardEvaluationContext(new BooleanHolder()); Object value = parser.parseExpression("simpleProperty").getValue(evaluationContext); + assertNotNull(value); } @Test @@ -1694,6 +1697,7 @@ public class SpelReproTests extends ExpressionTestCase { ExpressionParser parser = new SpelExpressionParser(); StandardEvaluationContext evaluationContext = new StandardEvaluationContext(new BooleanHolder()); Class valueType = parser.parseExpression("primitiveProperty").getValueType(evaluationContext); + assertNotNull(valueType); } @Test @@ -1701,6 +1705,7 @@ public class SpelReproTests extends ExpressionTestCase { ExpressionParser parser = new SpelExpressionParser(); StandardEvaluationContext evaluationContext = new StandardEvaluationContext(new BooleanHolder()); Object value = parser.parseExpression("primitiveProperty").getValue(evaluationContext); + assertNotNull(value); } @Test diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/support/SQLStateExceptionTranslatorTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/support/SQLStateExceptionTranslatorTests.java index 3578c1e93b..0aad57f96d 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/support/SQLStateExceptionTranslatorTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/support/SQLStateExceptionTranslatorTests.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. @@ -67,7 +67,6 @@ public class SQLStateExceptionTranslatorTests extends TestCase { * Bug 729170 */ public void testMalformedSqlStateCodes() { - String sql = "SELECT FOO FROM BAR"; SQLException sex = new SQLException("Message", null, 1); testMalformedSqlStateCode(sex); diff --git a/spring-jms/src/test/java/org/springframework/jms/core/JmsTemplate102Tests.java b/spring-jms/src/test/java/org/springframework/jms/core/JmsTemplate102Tests.java index abcb7a7e66..12f01be2b5 100644 --- a/spring-jms/src/test/java/org/springframework/jms/core/JmsTemplate102Tests.java +++ b/spring-jms/src/test/java/org/springframework/jms/core/JmsTemplate102Tests.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. @@ -207,7 +207,7 @@ public class JmsTemplate102Tests extends TestCase { template.execute(new SessionCallback() { @Override public Object doInJms(Session session) throws JMSException { - boolean b = session.getTransacted(); + session.getTransacted(); return null; } }); @@ -249,8 +249,8 @@ public class JmsTemplate102Tests extends TestCase { template.execute(new ProducerCallback() { @Override public Object doInJms(Session session, MessageProducer producer) throws JMSException { - boolean b = session.getTransacted(); - int i = producer.getPriority(); + session.getTransacted(); + producer.getPriority(); return null; } }); diff --git a/spring-jms/src/test/java/org/springframework/jms/core/JmsTemplateTests.java b/spring-jms/src/test/java/org/springframework/jms/core/JmsTemplateTests.java index 500874d8a1..2ff2c9afda 100644 --- a/spring-jms/src/test/java/org/springframework/jms/core/JmsTemplateTests.java +++ b/spring-jms/src/test/java/org/springframework/jms/core/JmsTemplateTests.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. @@ -190,8 +190,8 @@ public class JmsTemplateTests extends TestCase { template.execute(new ProducerCallback() { @Override public Object doInJms(Session session, MessageProducer producer) throws JMSException { - boolean b = session.getTransacted(); - int i = producer.getPriority(); + session.getTransacted(); + producer.getPriority(); return null; } }); @@ -234,8 +234,8 @@ public class JmsTemplateTests extends TestCase { template.execute(new ProducerCallback() { @Override public Object doInJms(Session session, MessageProducer producer) throws JMSException { - boolean b = session.getTransacted(); - int i = producer.getPriority(); + session.getTransacted(); + producer.getPriority(); return null; } }); @@ -264,7 +264,7 @@ public class JmsTemplateTests extends TestCase { template.execute(new SessionCallback() { @Override public Object doInJms(Session session) throws JMSException { - boolean b = session.getTransacted(); + session.getTransacted(); return null; } }); @@ -303,14 +303,14 @@ public class JmsTemplateTests extends TestCase { template.execute(new SessionCallback() { @Override public Object doInJms(Session session) throws JMSException { - boolean b = session.getTransacted(); + session.getTransacted(); return null; } }); template.execute(new SessionCallback() { @Override public Object doInJms(Session session) throws JMSException { - boolean b = session.getTransacted(); + session.getTransacted(); return null; } }); @@ -321,7 +321,7 @@ public class JmsTemplateTests extends TestCase { TransactionAwareConnectionFactoryProxy tacf = new TransactionAwareConnectionFactoryProxy(scf); Connection tac = tacf.createConnection(); Session tas = tac.createSession(false, Session.AUTO_ACKNOWLEDGE); - boolean b = tas.getTransacted(); + tas.getTransacted(); tas.close(); tac.close(); diff --git a/spring-orm/src/test/java/org/springframework/orm/jpa/ApplicationManagedEntityManagerIntegrationTests.java b/spring-orm/src/test/java/org/springframework/orm/jpa/ApplicationManagedEntityManagerIntegrationTests.java index 23f241e5ab..920099caf9 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jpa/ApplicationManagedEntityManagerIntegrationTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jpa/ApplicationManagedEntityManagerIntegrationTests.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. @@ -48,6 +48,7 @@ public class ApplicationManagedEntityManagerIntegrationTests extends AbstractEnt assertTrue(Proxy.isProxyClass(em.getClass())); Query q = em.createQuery("select p from Person as p"); List people = q.getResultList(); + assertNotNull(people); assertTrue("Should be open to start with", em.isOpen()); em.close(); diff --git a/spring-tx/src/test/java/org/springframework/transaction/interceptor/AbstractTransactionAspectTests.java b/spring-tx/src/test/java/org/springframework/transaction/interceptor/AbstractTransactionAspectTests.java index 2b01ef4a91..0a49a21b63 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/interceptor/AbstractTransactionAspectTests.java +++ b/spring-tx/src/test/java/org/springframework/transaction/interceptor/AbstractTransactionAspectTests.java @@ -539,7 +539,7 @@ public abstract class AbstractTransactionAspectTests extends TestCase { Method m = setNameMethod; MapTransactionAttributeSource tas = new MapTransactionAttributeSource(); tas.register(m, txatt); - Method m2 = getNameMethod; + // Method m2 = getNameMethod; // No attributes for m2 MockControl ptmControl = MockControl.createControl(PlatformTransactionManager.class); diff --git a/spring-tx/src/test/java/org/springframework/transaction/interceptor/BeanFactoryTransactionTests.java b/spring-tx/src/test/java/org/springframework/transaction/interceptor/BeanFactoryTransactionTests.java index 1ff4a262f4..1dda314dda 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/interceptor/BeanFactoryTransactionTests.java +++ b/spring-tx/src/test/java/org/springframework/transaction/interceptor/BeanFactoryTransactionTests.java @@ -163,6 +163,7 @@ public class BeanFactoryTransactionTests extends TestCase { public void testGetBeansOfTypeWithAbstract() { Map beansOfType = factory.getBeansOfType(ITestBean.class, true, true); + assertNotNull(beansOfType); } /** @@ -172,7 +173,7 @@ public class BeanFactoryTransactionTests extends TestCase { try { DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); new XmlBeanDefinitionReader(bf).loadBeanDefinitions(new ClassPathResource("noTransactionAttributeSource.xml", getClass())); - ITestBean testBean = (ITestBean) bf.getBean("noTransactionAttributeSource"); + bf.getBean("noTransactionAttributeSource"); fail("Should require TransactionAttributeSource to be set"); } catch (FatalBeanException ex) { diff --git a/spring-web/src/test/java/org/springframework/http/client/StreamingSimpleHttpRequestFactoryTests.java b/spring-web/src/test/java/org/springframework/http/client/StreamingSimpleHttpRequestFactoryTests.java index ccb91450a4..6eed7ae1be 100644 --- a/spring-web/src/test/java/org/springframework/http/client/StreamingSimpleHttpRequestFactoryTests.java +++ b/spring-web/src/test/java/org/springframework/http/client/StreamingSimpleHttpRequestFactoryTests.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. @@ -81,7 +81,7 @@ public class StreamingSimpleHttpRequestFactoryTests extends AbstractHttpRequestF ClientHttpRequest request = factory.createRequest(new URI(baseUrl + "/methods/post"), HttpMethod.POST); final int BUF_SIZE = 4096; final int ITERATIONS = Integer.MAX_VALUE / BUF_SIZE; - final int contentLength = ITERATIONS * BUF_SIZE; +// final int contentLength = ITERATIONS * BUF_SIZE; // request.getHeaders().setContentLength(contentLength); OutputStream body = request.getBody(); for (int i = 0; i < ITERATIONS; i++) { diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/ResponseStatusExceptionResolverTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/ResponseStatusExceptionResolverTests.java index 25348f53f7..4731ce6fed 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/ResponseStatusExceptionResolverTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/ResponseStatusExceptionResolverTests.java @@ -63,7 +63,7 @@ public class ResponseStatusExceptionResolverTests { exceptionResolver.setMessageSource(messageSource); StatusCodeAndReasonMessageException ex = new StatusCodeAndReasonMessageException(); - ModelAndView mav = exceptionResolver.resolveException(request, response, null, ex); + exceptionResolver.resolveException(request, response, null, ex); assertEquals("Invalid status reason", "Gone reason message", response.getErrorMessage()); } finally { diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/multiaction/MultiActionControllerTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/multiaction/MultiActionControllerTests.java index 64de09b05a..de40940d0d 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/multiaction/MultiActionControllerTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/multiaction/MultiActionControllerTests.java @@ -453,7 +453,7 @@ public class MultiActionControllerTests extends TestCase { MockHttpServletRequest request = new MockHttpServletRequest("GET", "/handleIllegalStateException.html"); MockHttpServletResponse response = new MockHttpServletResponse(); - ModelAndView mav = mac.handleRequest(request, response); + mac.handleRequest(request, response); assertEquals(HttpServletResponse.SC_NOT_FOUND, response.getStatus()); } @@ -524,7 +524,6 @@ public class MultiActionControllerTests extends TestCase { this.invoked.put("commandNoSession", Boolean.TRUE); String pname = request.getParameter("name"); - String page = request.getParameter("age"); // ALLOW FOR NULL if (pname == null) { assertTrue("name null", command.getName() == null); @@ -532,6 +531,8 @@ public class MultiActionControllerTests extends TestCase { else { assertTrue("name param set", pname.equals(command.getName())); } + + //String page = request.getParameter("age"); // if (page == null) // assertTrue("age default", command.getAge() == 0); // else diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/ResourceBundleViewResolverTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/ResourceBundleViewResolverTests.java index b100a6a68e..19e4551fb3 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/ResourceBundleViewResolverTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/ResourceBundleViewResolverTests.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. @@ -72,14 +72,14 @@ public class ResourceBundleViewResolverTests extends TestCase { public void testParentsAreAbstract() throws Exception { try { - View v = rb.resolveViewName("debug.Parent", Locale.ENGLISH); + rb.resolveViewName("debug.Parent", Locale.ENGLISH); fail("Should have thrown BeanIsAbstractException"); } catch (BeanIsAbstractException ex) { // expected } try { - View v = rb.resolveViewName("testParent", Locale.ENGLISH); + rb.resolveViewName("testParent", Locale.ENGLISH); fail("Should have thrown BeanIsAbstractException"); } catch (BeanIsAbstractException ex) { @@ -152,7 +152,7 @@ public class ResourceBundleViewResolverTests extends TestCase { public void testNoSuchBasename() throws Exception { try { rb.setBasename("weoriwoierqupowiuer"); - View v = rb.resolveViewName("debugView", Locale.ENGLISH); + rb.resolveViewName("debugView", Locale.ENGLISH); fail("No such basename: all requests should fail with exception"); } catch (MissingResourceException ex) { diff --git a/src/test/java/org/springframework/context/annotation/jsr330/ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests.java b/src/test/java/org/springframework/context/annotation/jsr330/ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests.java index b213a2a4e0..5f5938ed36 100644 --- a/src/test/java/org/springframework/context/annotation/jsr330/ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests.java +++ b/src/test/java/org/springframework/context/annotation/jsr330/ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests.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. @@ -86,6 +86,7 @@ public class ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests { public void testPrototype() { ApplicationContext context = createContext(ScopedProxyMode.NO); ScopedTestBean bean = (ScopedTestBean) context.getBean("prototype"); + assertNotNull(bean); assertTrue(context.isPrototype("prototype")); assertFalse(context.isSingleton("prototype")); } From 2b0d8609231deaf1a3790334f6ffd7dae326aa0e Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Fri, 25 Jan 2013 17:30:58 -0800 Subject: [PATCH 4/5] Fix Javadoc warnings --- .../org/springframework/beans/ExtendedBeanInfo.java | 4 ++-- .../java/org/springframework/util/ObjectUtils.java | 10 +++++----- .../core/type/CachingMetadataReaderLeakTest.java | 2 +- .../java/org/springframework/web/util/UriTemplate.java | 4 ++-- .../AopNamespaceHandlerScopeIntegrationTests.java | 2 +- .../AdvisorAutoProxyCreatorIntegrationTests.java | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/spring-beans/src/main/java/org/springframework/beans/ExtendedBeanInfo.java b/spring-beans/src/main/java/org/springframework/beans/ExtendedBeanInfo.java index c3609c10c2..6606741ee4 100644 --- a/spring-beans/src/main/java/org/springframework/beans/ExtendedBeanInfo.java +++ b/spring-beans/src/main/java/org/springframework/beans/ExtendedBeanInfo.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. @@ -56,7 +56,7 @@ import static org.springframework.beans.PropertyDescriptorUtils.*; * this.foo = foo; * return this; * } - * } + * }} * The standard JavaBeans {@code Introspector} will discover the {@code getFoo} read * method, but will bypass the {@code #setFoo(Foo)} write method, because its non-void * returning signature does not comply with the JavaBeans specification. diff --git a/spring-core/src/main/java/org/springframework/util/ObjectUtils.java b/spring-core/src/main/java/org/springframework/util/ObjectUtils.java index 3ec3617418..09980f1e2c 100644 --- a/spring-core/src/main/java/org/springframework/util/ObjectUtils.java +++ b/spring-core/src/main/java/org/springframework/util/ObjectUtils.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. @@ -481,7 +481,7 @@ public abstract class ObjectUtils { } /** - * Return the same value as {@code {@link Boolean#hashCode()}}. + * Return the same value as {@link Boolean#hashCode()}}. * @see Boolean#hashCode() */ public static int hashCode(boolean bool) { @@ -489,7 +489,7 @@ public abstract class ObjectUtils { } /** - * Return the same value as {@code {@link Double#hashCode()}}. + * Return the same value as {@link Double#hashCode()}}. * @see Double#hashCode() */ public static int hashCode(double dbl) { @@ -498,7 +498,7 @@ public abstract class ObjectUtils { } /** - * Return the same value as {@code {@link Float#hashCode()}}. + * Return the same value as {@link Float#hashCode()}}. * @see Float#hashCode() */ public static int hashCode(float flt) { @@ -506,7 +506,7 @@ public abstract class ObjectUtils { } /** - * Return the same value as {@code {@link Long#hashCode()}}. + * Return the same value as {@link Long#hashCode()}}. * @see Long#hashCode() */ public static int hashCode(long lng) { diff --git a/spring-core/src/test/java/org/springframework/core/type/CachingMetadataReaderLeakTest.java b/spring-core/src/test/java/org/springframework/core/type/CachingMetadataReaderLeakTest.java index db0b50242d..1d138b76f6 100644 --- a/spring-core/src/test/java/org/springframework/core/type/CachingMetadataReaderLeakTest.java +++ b/spring-core/src/test/java/org/springframework/core/type/CachingMetadataReaderLeakTest.java @@ -31,7 +31,7 @@ import org.springframework.tests.Assume; import org.springframework.tests.TestGroup; /** - * Unit test checking the behaviour of {@link CachingMetadataReaderFactory under load. + * Unit test checking the behaviour of {@link CachingMetadataReaderFactory} under load. * If the cache is not controller, this test should fail with an out of memory exception around entry * 5k. * diff --git a/spring-web/src/main/java/org/springframework/web/util/UriTemplate.java b/spring-web/src/main/java/org/springframework/web/util/UriTemplate.java index a8699042e9..3aacd60559 100644 --- a/spring-web/src/main/java/org/springframework/web/util/UriTemplate.java +++ b/spring-web/src/main/java/org/springframework/web/util/UriTemplate.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. @@ -32,7 +32,7 @@ import org.springframework.util.Assert; /** * Represents a URI template. A URI template is a URI-like String that contains variables enclosed - * by braces ({@code {}, {@code }}), which can be expanded to produce an actual URI. + * by braces ({@code {}}), which can be expanded to produce an actual URI. * *

See {@link #expand(Map)}, {@link #expand(Object[])}, and {@link #match(String)} for example usages. * diff --git a/src/test/java/org/springframework/aop/config/AopNamespaceHandlerScopeIntegrationTests.java b/src/test/java/org/springframework/aop/config/AopNamespaceHandlerScopeIntegrationTests.java index 8a3c178627..067a335166 100644 --- a/src/test/java/org/springframework/aop/config/AopNamespaceHandlerScopeIntegrationTests.java +++ b/src/test/java/org/springframework/aop/config/AopNamespaceHandlerScopeIntegrationTests.java @@ -41,7 +41,7 @@ import org.springframework.web.context.support.XmlWebApplicationContext; * Integration tests for scoped proxy use in conjunction with aop: namespace. * Deemed an integration test because .web mocks and application contexts are required. * - * @see org.springframework.aop.config.AopNamespaceHandlerTests; + * @see org.springframework.aop.config.AopNamespaceHandlerTests * * @author Rob Harrop * @author Juergen Hoeller diff --git a/src/test/java/org/springframework/aop/framework/autoproxy/AdvisorAutoProxyCreatorIntegrationTests.java b/src/test/java/org/springframework/aop/framework/autoproxy/AdvisorAutoProxyCreatorIntegrationTests.java index d2fbb3e1e0..a972be2d97 100644 --- a/src/test/java/org/springframework/aop/framework/autoproxy/AdvisorAutoProxyCreatorIntegrationTests.java +++ b/src/test/java/org/springframework/aop/framework/autoproxy/AdvisorAutoProxyCreatorIntegrationTests.java @@ -44,7 +44,7 @@ import org.springframework.transaction.interceptor.TransactionInterceptor; * Integration tests for auto proxy creation by advisor recognition working in * conjunction with transaction managment resources. * - * @see org.springframework.aop.framework.autoproxy.AdvisorAutoProxyCreatorTests; + * @see org.springframework.aop.framework.autoproxy.AdvisorAutoProxyCreatorTests * * @author Rod Johnson * @author Chris Beams From d89e30b864c3303b2ba881451c38329bd3c16a09 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Tue, 29 Jan 2013 15:37:25 -0800 Subject: [PATCH 5/5] Fix unnecessary @SupressWarnings annotations --- .../annotation/AbstractAspectJAdvisorFactoryTests.java | 1 - .../org/springframework/beans/BeanWrapperGenericsTests.java | 1 - .../org/springframework/beans/ExtendedBeanInfoTests.java | 1 - .../beans/factory/DefaultListableBeanFactoryTests.java | 1 - .../context/event/SimpleApplicationEventMulticaster.java | 1 - .../src/test/java/example/scannable/FooServiceImpl.java | 1 - .../annotation/AnnotationConfigApplicationContextTests.java | 1 - .../context/annotation/BeanMethodPolymorphismTests.java | 2 +- .../BeanAnnotationAttributePropagationTests.java | 1 - .../FormattingConversionServiceFactoryBeanTests.java | 1 - .../format/support/FormattingConversionServiceTests.java | 1 - .../glassfish/GlassFishLoadTimeWeaverTests.java | 1 - .../scheduling/annotation/EnableAsyncTests.java | 1 - .../core/convert/support/GenericConversionServiceTests.java | 1 - .../jdbc/datasource/embedded/EmbeddedDatabaseFactory.java | 1 - .../main/java/org/springframework/orm/jdo/JdoTemplate.java | 1 - .../web/servlet/result/FlashAttributeResultMatchers.java | 1 - .../http/converter/FormHttpMessageConverterTests.java | 1 - .../method/annotation/InitBinderDataBinderFactoryTests.java | 6 +----- .../annotation/ModelAttributeMethodProcessorTests.java | 3 +-- 20 files changed, 3 insertions(+), 25 deletions(-) diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AbstractAspectJAdvisorFactoryTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AbstractAspectJAdvisorFactoryTests.java index 3faf43c07c..5180ca7d14 100644 --- a/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AbstractAspectJAdvisorFactoryTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AbstractAspectJAdvisorFactoryTests.java @@ -404,7 +404,6 @@ public abstract class AbstractAspectJAdvisorFactoryTests { } } - @SuppressWarnings("unchecked") @Test public void testIntroductionOnTargetExcludedByTypePattern() { LinkedList target = new LinkedList(); diff --git a/spring-beans/src/test/java/org/springframework/beans/BeanWrapperGenericsTests.java b/spring-beans/src/test/java/org/springframework/beans/BeanWrapperGenericsTests.java index 88f647850d..3a9e03accc 100644 --- a/spring-beans/src/test/java/org/springframework/beans/BeanWrapperGenericsTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/BeanWrapperGenericsTests.java @@ -157,7 +157,6 @@ public class BeanWrapperGenericsTests { GenericBean gb = new GenericBean(); BeanWrapper bw = new BeanWrapperImpl(gb); bw.registerCustomEditor(Number.class, new CustomNumberEditor(Integer.class, false)); - @SuppressWarnings("unchecked") Map input = new HashMap(); HashSet value1 = new HashSet(); value1.add(new Integer(1)); diff --git a/spring-beans/src/test/java/org/springframework/beans/ExtendedBeanInfoTests.java b/spring-beans/src/test/java/org/springframework/beans/ExtendedBeanInfoTests.java index ec2ca31e2b..30b2013d07 100644 --- a/spring-beans/src/test/java/org/springframework/beans/ExtendedBeanInfoTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/ExtendedBeanInfoTests.java @@ -974,7 +974,6 @@ public class ExtendedBeanInfoTests { } static class WithStaticWriteMethod { - @SuppressWarnings("unused") public static void setProp1(String prop1) { } } diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java index 59141704b7..4045578c8c 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java @@ -2200,7 +2200,6 @@ public class DefaultListableBeanFactoryTests { doTestFieldSettingWithInstantiationAwarePostProcessor(true); } - @SuppressWarnings("unchecked") private void doTestFieldSettingWithInstantiationAwarePostProcessor(final boolean skipPropertyPopulation) { DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); RootBeanDefinition bd = new RootBeanDefinition(TestBean.class); diff --git a/spring-context/src/main/java/org/springframework/context/event/SimpleApplicationEventMulticaster.java b/spring-context/src/main/java/org/springframework/context/event/SimpleApplicationEventMulticaster.java index 2e13855d4a..71e4ec5369 100644 --- a/spring-context/src/main/java/org/springframework/context/event/SimpleApplicationEventMulticaster.java +++ b/spring-context/src/main/java/org/springframework/context/event/SimpleApplicationEventMulticaster.java @@ -87,7 +87,6 @@ public class SimpleApplicationEventMulticaster extends AbstractApplicationEventM Executor executor = getTaskExecutor(); if (executor != null) { executor.execute(new Runnable() { - @SuppressWarnings("unchecked") public void run() { listener.onApplicationEvent(event); } diff --git a/spring-context/src/test/java/example/scannable/FooServiceImpl.java b/spring-context/src/test/java/example/scannable/FooServiceImpl.java index 1db44f5bb0..15da02b0f2 100644 --- a/spring-context/src/test/java/example/scannable/FooServiceImpl.java +++ b/spring-context/src/test/java/example/scannable/FooServiceImpl.java @@ -65,7 +65,6 @@ public class FooServiceImpl implements FooService { private boolean initCalled = false; - @SuppressWarnings("unused") @PostConstruct private void init() { if (this.initCalled) { diff --git a/spring-context/src/test/java/org/springframework/context/annotation/AnnotationConfigApplicationContextTests.java b/spring-context/src/test/java/org/springframework/context/annotation/AnnotationConfigApplicationContextTests.java index 5906ea485d..f53c9e1a25 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/AnnotationConfigApplicationContextTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/AnnotationConfigApplicationContextTests.java @@ -133,7 +133,6 @@ public class AnnotationConfigApplicationContextTests { } } - @SuppressWarnings("unchecked") @Test public void getBeanByTypeAmbiguityRaisesException() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(TwoTestBeanConfig.class); 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 655324d1c7..1d573540f8 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 @@ -47,7 +47,7 @@ public class BeanMethodPolymorphismTests { @Test public void beanMethodOverloadingWithoutInheritance() { - @SuppressWarnings({ "unused", "hiding" }) + @SuppressWarnings({ "hiding" }) @Configuration class Config { @Bean String aString() { return "na"; } @Bean String aString(Integer dependency) { return "na"; } diff --git a/spring-context/src/test/java/org/springframework/context/annotation/configuration/BeanAnnotationAttributePropagationTests.java b/spring-context/src/test/java/org/springframework/context/annotation/configuration/BeanAnnotationAttributePropagationTests.java index f0dcbab8ab..f063133eab 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/configuration/BeanAnnotationAttributePropagationTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/configuration/BeanAnnotationAttributePropagationTests.java @@ -41,7 +41,6 @@ import org.springframework.context.annotation.DependsOn; * * @author Chris Beams */ -@SuppressWarnings("unused") // for unused @Bean methods in local classes public class BeanAnnotationAttributePropagationTests { @Test diff --git a/spring-context/src/test/java/org/springframework/format/support/FormattingConversionServiceFactoryBeanTests.java b/spring-context/src/test/java/org/springframework/format/support/FormattingConversionServiceFactoryBeanTests.java index ae9aa8be0e..284b238e56 100644 --- a/spring-context/src/test/java/org/springframework/format/support/FormattingConversionServiceFactoryBeanTests.java +++ b/spring-context/src/test/java/org/springframework/format/support/FormattingConversionServiceFactoryBeanTests.java @@ -130,7 +130,6 @@ public class FormattingConversionServiceFactoryBeanTests { private static class TestBean { - @SuppressWarnings("unused") @NumberFormat(style = Style.PERCENT) private double percent; diff --git a/spring-context/src/test/java/org/springframework/format/support/FormattingConversionServiceTests.java b/spring-context/src/test/java/org/springframework/format/support/FormattingConversionServiceTests.java index 6b0fb87da7..417ded1a45 100644 --- a/spring-context/src/test/java/org/springframework/format/support/FormattingConversionServiceTests.java +++ b/spring-context/src/test/java/org/springframework/format/support/FormattingConversionServiceTests.java @@ -393,7 +393,6 @@ public class FormattingConversionServiceTests { private static class ModelWithSubclassField { - @SuppressWarnings("unused") @org.springframework.format.annotation.DateTimeFormat(style = "S-") public MyDate date; } diff --git a/spring-context/src/test/java/org/springframework/instrument/classloading/glassfish/GlassFishLoadTimeWeaverTests.java b/spring-context/src/test/java/org/springframework/instrument/classloading/glassfish/GlassFishLoadTimeWeaverTests.java index b2efa269c1..7907a51871 100644 --- a/spring-context/src/test/java/org/springframework/instrument/classloading/glassfish/GlassFishLoadTimeWeaverTests.java +++ b/spring-context/src/test/java/org/springframework/instrument/classloading/glassfish/GlassFishLoadTimeWeaverTests.java @@ -20,7 +20,6 @@ import org.junit.Ignore; // converting away from old-style EasyMock APIs was problematic with this class // glassfish dependencies no longer on classpath -@SuppressWarnings("deprecation") @Ignore public class GlassFishLoadTimeWeaverTests { diff --git a/spring-context/src/test/java/org/springframework/scheduling/annotation/EnableAsyncTests.java b/spring-context/src/test/java/org/springframework/scheduling/annotation/EnableAsyncTests.java index 3b3329e0d9..bc30910d5f 100644 --- a/spring-context/src/test/java/org/springframework/scheduling/annotation/EnableAsyncTests.java +++ b/spring-context/src/test/java/org/springframework/scheduling/annotation/EnableAsyncTests.java @@ -74,7 +74,6 @@ public class EnableAsyncTests { } - @SuppressWarnings("unchecked") @Test public void withAsyncBeanWithExecutorQualifiedByName() throws ExecutionException, InterruptedException { AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); diff --git a/spring-core/src/test/java/org/springframework/core/convert/support/GenericConversionServiceTests.java b/spring-core/src/test/java/org/springframework/core/convert/support/GenericConversionServiceTests.java index 01dd03c770..c08cdeebb7 100644 --- a/spring-core/src/test/java/org/springframework/core/convert/support/GenericConversionServiceTests.java +++ b/spring-core/src/test/java/org/springframework/core/convert/support/GenericConversionServiceTests.java @@ -358,7 +358,6 @@ public class GenericConversionServiceTests { GenericConversionService service = new DefaultConversionService(); List list1 = Arrays.asList("Foo", "Bar"); List list2 = Arrays.asList("Baz", "Boop"); - @SuppressWarnings("unchecked") List> list = Arrays.asList(list1, list2); String result = service.convert(list, String.class); assertNotNull(result); diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseFactory.java b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseFactory.java index 5e3db7cff4..20a5bfdf61 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseFactory.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseFactory.java @@ -205,7 +205,6 @@ public class EmbeddedDatabaseFactory { } // getParentLogger() is required for JDBC 4.1 compatibility - @SuppressWarnings("unused") public Logger getParentLogger() { return Logger.getLogger(Logger.GLOBAL_LOGGER_NAME); } diff --git a/spring-orm/src/main/java/org/springframework/orm/jdo/JdoTemplate.java b/spring-orm/src/main/java/org/springframework/orm/jdo/JdoTemplate.java index ce0f61aefc..6ed2028384 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jdo/JdoTemplate.java +++ b/spring-orm/src/main/java/org/springframework/orm/jdo/JdoTemplate.java @@ -481,7 +481,6 @@ public class JdoTemplate extends JdoAccessor implements JdoOperations { public Collection find(final String queryString) throws DataAccessException { return execute(new JdoCallback() { - @SuppressWarnings("unchecked") public Collection doInJdo(PersistenceManager pm) throws JDOException { Query query = pm.newQuery(queryString); prepareQuery(query); diff --git a/spring-test-mvc/src/main/java/org/springframework/test/web/servlet/result/FlashAttributeResultMatchers.java b/spring-test-mvc/src/main/java/org/springframework/test/web/servlet/result/FlashAttributeResultMatchers.java index 61c2f37df6..a2747bb102 100644 --- a/spring-test-mvc/src/main/java/org/springframework/test/web/servlet/result/FlashAttributeResultMatchers.java +++ b/spring-test-mvc/src/main/java/org/springframework/test/web/servlet/result/FlashAttributeResultMatchers.java @@ -57,7 +57,6 @@ public class FlashAttributeResultMatchers { */ public ResultMatcher attribute(final String name, final Object value) { return new ResultMatcher() { - @SuppressWarnings("unchecked") public void match(MvcResult result) throws Exception { assertEquals("Flash attribute", value, result.getFlashMap().get(name)); } diff --git a/spring-web/src/test/java/org/springframework/http/converter/FormHttpMessageConverterTests.java b/spring-web/src/test/java/org/springframework/http/converter/FormHttpMessageConverterTests.java index 0792d6c6a8..908783e4c1 100644 --- a/spring-web/src/test/java/org/springframework/http/converter/FormHttpMessageConverterTests.java +++ b/spring-web/src/test/java/org/springframework/http/converter/FormHttpMessageConverterTests.java @@ -72,7 +72,6 @@ public class FormHttpMessageConverterTests { } @Test - @SuppressWarnings("unchecked") public void readForm() throws Exception { String body = "name+1=value+1&name+2=value+2%2B1&name+2=value+2%2B2&name+3"; Charset iso88591 = Charset.forName("ISO-8859-1"); diff --git a/spring-web/src/test/java/org/springframework/web/method/annotation/InitBinderDataBinderFactoryTests.java b/spring-web/src/test/java/org/springframework/web/method/annotation/InitBinderDataBinderFactoryTests.java index 40b600377c..866fcae1ad 100644 --- a/spring-web/src/test/java/org/springframework/web/method/annotation/InitBinderDataBinderFactoryTests.java +++ b/spring-web/src/test/java/org/springframework/web/method/annotation/InitBinderDataBinderFactoryTests.java @@ -140,29 +140,25 @@ public class InitBinderDataBinderFactoryTests { private static class InitBinderHandler { - @SuppressWarnings("unused") @InitBinder public void initBinder(WebDataBinder dataBinder) { dataBinder.setDisallowedFields("id"); } - @SuppressWarnings("unused") @InitBinder(value="foo") public void initBinderWithAttributeName(WebDataBinder dataBinder) { dataBinder.setDisallowedFields("id"); } - @SuppressWarnings("unused") @InitBinder public String initBinderReturnValue(WebDataBinder dataBinder) { return "invalid"; } - @SuppressWarnings("unused") @InitBinder public void initBinderTypeConversion(WebDataBinder dataBinder, @RequestParam int requestParam) { dataBinder.setDisallowedFields("requestParam-" + requestParam); } } -} \ No newline at end of file +} diff --git a/spring-web/src/test/java/org/springframework/web/method/annotation/ModelAttributeMethodProcessorTests.java b/spring-web/src/test/java/org/springframework/web/method/annotation/ModelAttributeMethodProcessorTests.java index 170e8e2c9b..42c13d2671 100644 --- a/spring-web/src/test/java/org/springframework/web/method/annotation/ModelAttributeMethodProcessorTests.java +++ b/spring-web/src/test/java/org/springframework/web/method/annotation/ModelAttributeMethodProcessorTests.java @@ -299,7 +299,6 @@ public class ModelAttributeMethodProcessorTests { } } - @SuppressWarnings("unused") @ModelAttribute("modelAttrName") private String annotatedReturnValue() { return null; @@ -310,4 +309,4 @@ public class ModelAttributeMethodProcessorTests { return null; } -} \ No newline at end of file +}