提交 d89e30b8 编写于 作者: P Phillip Webb

Fix unnecessary @SupressWarnings annotations

上级 2b0d8609
...@@ -404,7 +404,6 @@ public abstract class AbstractAspectJAdvisorFactoryTests { ...@@ -404,7 +404,6 @@ public abstract class AbstractAspectJAdvisorFactoryTests {
} }
} }
@SuppressWarnings("unchecked")
@Test @Test
public void testIntroductionOnTargetExcludedByTypePattern() { public void testIntroductionOnTargetExcludedByTypePattern() {
LinkedList target = new LinkedList(); LinkedList target = new LinkedList();
......
...@@ -157,7 +157,6 @@ public class BeanWrapperGenericsTests { ...@@ -157,7 +157,6 @@ public class BeanWrapperGenericsTests {
GenericBean<?> gb = new GenericBean<Object>(); GenericBean<?> gb = new GenericBean<Object>();
BeanWrapper bw = new BeanWrapperImpl(gb); BeanWrapper bw = new BeanWrapperImpl(gb);
bw.registerCustomEditor(Number.class, new CustomNumberEditor(Integer.class, false)); bw.registerCustomEditor(Number.class, new CustomNumberEditor(Integer.class, false));
@SuppressWarnings("unchecked")
Map<String, Collection> input = new HashMap<String, Collection>(); Map<String, Collection> input = new HashMap<String, Collection>();
HashSet<Integer> value1 = new HashSet<Integer>(); HashSet<Integer> value1 = new HashSet<Integer>();
value1.add(new Integer(1)); value1.add(new Integer(1));
......
...@@ -974,7 +974,6 @@ public class ExtendedBeanInfoTests { ...@@ -974,7 +974,6 @@ public class ExtendedBeanInfoTests {
} }
static class WithStaticWriteMethod { static class WithStaticWriteMethod {
@SuppressWarnings("unused")
public static void setProp1(String prop1) { public static void setProp1(String prop1) {
} }
} }
......
...@@ -2200,7 +2200,6 @@ public class DefaultListableBeanFactoryTests { ...@@ -2200,7 +2200,6 @@ public class DefaultListableBeanFactoryTests {
doTestFieldSettingWithInstantiationAwarePostProcessor(true); doTestFieldSettingWithInstantiationAwarePostProcessor(true);
} }
@SuppressWarnings("unchecked")
private void doTestFieldSettingWithInstantiationAwarePostProcessor(final boolean skipPropertyPopulation) { private void doTestFieldSettingWithInstantiationAwarePostProcessor(final boolean skipPropertyPopulation) {
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
RootBeanDefinition bd = new RootBeanDefinition(TestBean.class); RootBeanDefinition bd = new RootBeanDefinition(TestBean.class);
......
...@@ -87,7 +87,6 @@ public class SimpleApplicationEventMulticaster extends AbstractApplicationEventM ...@@ -87,7 +87,6 @@ public class SimpleApplicationEventMulticaster extends AbstractApplicationEventM
Executor executor = getTaskExecutor(); Executor executor = getTaskExecutor();
if (executor != null) { if (executor != null) {
executor.execute(new Runnable() { executor.execute(new Runnable() {
@SuppressWarnings("unchecked")
public void run() { public void run() {
listener.onApplicationEvent(event); listener.onApplicationEvent(event);
} }
......
...@@ -65,7 +65,6 @@ public class FooServiceImpl implements FooService { ...@@ -65,7 +65,6 @@ public class FooServiceImpl implements FooService {
private boolean initCalled = false; private boolean initCalled = false;
@SuppressWarnings("unused")
@PostConstruct @PostConstruct
private void init() { private void init() {
if (this.initCalled) { if (this.initCalled) {
......
...@@ -133,7 +133,6 @@ public class AnnotationConfigApplicationContextTests { ...@@ -133,7 +133,6 @@ public class AnnotationConfigApplicationContextTests {
} }
} }
@SuppressWarnings("unchecked")
@Test @Test
public void getBeanByTypeAmbiguityRaisesException() { public void getBeanByTypeAmbiguityRaisesException() {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(TwoTestBeanConfig.class); AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(TwoTestBeanConfig.class);
......
...@@ -47,7 +47,7 @@ public class BeanMethodPolymorphismTests { ...@@ -47,7 +47,7 @@ public class BeanMethodPolymorphismTests {
@Test @Test
public void beanMethodOverloadingWithoutInheritance() { public void beanMethodOverloadingWithoutInheritance() {
@SuppressWarnings({ "unused", "hiding" }) @SuppressWarnings({ "hiding" })
@Configuration class Config { @Configuration class Config {
@Bean String aString() { return "na"; } @Bean String aString() { return "na"; }
@Bean String aString(Integer dependency) { return "na"; } @Bean String aString(Integer dependency) { return "na"; }
......
...@@ -41,7 +41,6 @@ import org.springframework.context.annotation.DependsOn; ...@@ -41,7 +41,6 @@ import org.springframework.context.annotation.DependsOn;
* *
* @author Chris Beams * @author Chris Beams
*/ */
@SuppressWarnings("unused") // for unused @Bean methods in local classes
public class BeanAnnotationAttributePropagationTests { public class BeanAnnotationAttributePropagationTests {
@Test @Test
......
...@@ -130,7 +130,6 @@ public class FormattingConversionServiceFactoryBeanTests { ...@@ -130,7 +130,6 @@ public class FormattingConversionServiceFactoryBeanTests {
private static class TestBean { private static class TestBean {
@SuppressWarnings("unused")
@NumberFormat(style = Style.PERCENT) @NumberFormat(style = Style.PERCENT)
private double percent; private double percent;
......
...@@ -393,7 +393,6 @@ public class FormattingConversionServiceTests { ...@@ -393,7 +393,6 @@ public class FormattingConversionServiceTests {
private static class ModelWithSubclassField { private static class ModelWithSubclassField {
@SuppressWarnings("unused")
@org.springframework.format.annotation.DateTimeFormat(style = "S-") @org.springframework.format.annotation.DateTimeFormat(style = "S-")
public MyDate date; public MyDate date;
} }
......
...@@ -20,7 +20,6 @@ import org.junit.Ignore; ...@@ -20,7 +20,6 @@ import org.junit.Ignore;
// converting away from old-style EasyMock APIs was problematic with this class // converting away from old-style EasyMock APIs was problematic with this class
// glassfish dependencies no longer on classpath // glassfish dependencies no longer on classpath
@SuppressWarnings("deprecation")
@Ignore @Ignore
public class GlassFishLoadTimeWeaverTests { public class GlassFishLoadTimeWeaverTests {
......
...@@ -74,7 +74,6 @@ public class EnableAsyncTests { ...@@ -74,7 +74,6 @@ public class EnableAsyncTests {
} }
@SuppressWarnings("unchecked")
@Test @Test
public void withAsyncBeanWithExecutorQualifiedByName() throws ExecutionException, InterruptedException { public void withAsyncBeanWithExecutorQualifiedByName() throws ExecutionException, InterruptedException {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
......
...@@ -358,7 +358,6 @@ public class GenericConversionServiceTests { ...@@ -358,7 +358,6 @@ public class GenericConversionServiceTests {
GenericConversionService service = new DefaultConversionService(); GenericConversionService service = new DefaultConversionService();
List<String> list1 = Arrays.asList("Foo", "Bar"); List<String> list1 = Arrays.asList("Foo", "Bar");
List<String> list2 = Arrays.asList("Baz", "Boop"); List<String> list2 = Arrays.asList("Baz", "Boop");
@SuppressWarnings("unchecked")
List<List<String>> list = Arrays.asList(list1, list2); List<List<String>> list = Arrays.asList(list1, list2);
String result = service.convert(list, String.class); String result = service.convert(list, String.class);
assertNotNull(result); assertNotNull(result);
......
...@@ -205,7 +205,6 @@ public class EmbeddedDatabaseFactory { ...@@ -205,7 +205,6 @@ public class EmbeddedDatabaseFactory {
} }
// getParentLogger() is required for JDBC 4.1 compatibility // getParentLogger() is required for JDBC 4.1 compatibility
@SuppressWarnings("unused")
public Logger getParentLogger() { public Logger getParentLogger() {
return Logger.getLogger(Logger.GLOBAL_LOGGER_NAME); return Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
} }
......
...@@ -481,7 +481,6 @@ public class JdoTemplate extends JdoAccessor implements JdoOperations { ...@@ -481,7 +481,6 @@ public class JdoTemplate extends JdoAccessor implements JdoOperations {
public Collection find(final String queryString) throws DataAccessException { public Collection find(final String queryString) throws DataAccessException {
return execute(new JdoCallback<Collection>() { return execute(new JdoCallback<Collection>() {
@SuppressWarnings("unchecked")
public Collection doInJdo(PersistenceManager pm) throws JDOException { public Collection doInJdo(PersistenceManager pm) throws JDOException {
Query query = pm.newQuery(queryString); Query query = pm.newQuery(queryString);
prepareQuery(query); prepareQuery(query);
......
...@@ -57,7 +57,6 @@ public class FlashAttributeResultMatchers { ...@@ -57,7 +57,6 @@ public class FlashAttributeResultMatchers {
*/ */
public <T> ResultMatcher attribute(final String name, final Object value) { public <T> ResultMatcher attribute(final String name, final Object value) {
return new ResultMatcher() { return new ResultMatcher() {
@SuppressWarnings("unchecked")
public void match(MvcResult result) throws Exception { public void match(MvcResult result) throws Exception {
assertEquals("Flash attribute", value, result.getFlashMap().get(name)); assertEquals("Flash attribute", value, result.getFlashMap().get(name));
} }
......
...@@ -72,7 +72,6 @@ public class FormHttpMessageConverterTests { ...@@ -72,7 +72,6 @@ public class FormHttpMessageConverterTests {
} }
@Test @Test
@SuppressWarnings("unchecked")
public void readForm() throws Exception { public void readForm() throws Exception {
String body = "name+1=value+1&name+2=value+2%2B1&name+2=value+2%2B2&name+3"; 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"); Charset iso88591 = Charset.forName("ISO-8859-1");
......
...@@ -140,29 +140,25 @@ public class InitBinderDataBinderFactoryTests { ...@@ -140,29 +140,25 @@ public class InitBinderDataBinderFactoryTests {
private static class InitBinderHandler { private static class InitBinderHandler {
@SuppressWarnings("unused")
@InitBinder @InitBinder
public void initBinder(WebDataBinder dataBinder) { public void initBinder(WebDataBinder dataBinder) {
dataBinder.setDisallowedFields("id"); dataBinder.setDisallowedFields("id");
} }
@SuppressWarnings("unused")
@InitBinder(value="foo") @InitBinder(value="foo")
public void initBinderWithAttributeName(WebDataBinder dataBinder) { public void initBinderWithAttributeName(WebDataBinder dataBinder) {
dataBinder.setDisallowedFields("id"); dataBinder.setDisallowedFields("id");
} }
@SuppressWarnings("unused")
@InitBinder @InitBinder
public String initBinderReturnValue(WebDataBinder dataBinder) { public String initBinderReturnValue(WebDataBinder dataBinder) {
return "invalid"; return "invalid";
} }
@SuppressWarnings("unused")
@InitBinder @InitBinder
public void initBinderTypeConversion(WebDataBinder dataBinder, @RequestParam int requestParam) { public void initBinderTypeConversion(WebDataBinder dataBinder, @RequestParam int requestParam) {
dataBinder.setDisallowedFields("requestParam-" + requestParam); dataBinder.setDisallowedFields("requestParam-" + requestParam);
} }
} }
} }
\ No newline at end of file
...@@ -299,7 +299,6 @@ public class ModelAttributeMethodProcessorTests { ...@@ -299,7 +299,6 @@ public class ModelAttributeMethodProcessorTests {
} }
} }
@SuppressWarnings("unused")
@ModelAttribute("modelAttrName") @ModelAttribute("modelAttrName")
private String annotatedReturnValue() { private String annotatedReturnValue() {
return null; return null;
...@@ -310,4 +309,4 @@ public class ModelAttributeMethodProcessorTests { ...@@ -310,4 +309,4 @@ public class ModelAttributeMethodProcessorTests {
return null; return null;
} }
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册