Merge branch 'cleanup-3.2.x' into 3.2.x
* cleanup-3.2.x: Fix unnecessary @SupressWarnings annotations Fix Javadoc warnings Fix unused local variable warnings Fix unused type compiler warnings Fix 'is already an instance of type' warnings
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -65,7 +65,6 @@ public class FooServiceImpl implements FooService {
|
||||
|
||||
private boolean initCalled = false;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@PostConstruct
|
||||
private void init() {
|
||||
if (this.initCalled) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -133,7 +133,6 @@ public class AnnotationConfigApplicationContextTests {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void getBeanByTypeAmbiguityRaisesException() {
|
||||
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(TwoTestBeanConfig.class);
|
||||
|
||||
@@ -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"; }
|
||||
|
||||
@@ -700,6 +700,7 @@ public class CommonAnnotationBeanPostProcessorTests {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class NullFactory {
|
||||
|
||||
public static Object create() {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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<String, Class<?>> 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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -130,7 +130,6 @@ public class FormattingConversionServiceFactoryBeanTests {
|
||||
|
||||
private static class TestBean {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@NumberFormat(style = Style.PERCENT)
|
||||
private double percent;
|
||||
|
||||
|
||||
@@ -393,7 +393,6 @@ public class FormattingConversionServiceTests {
|
||||
|
||||
private static class ModelWithSubclassField {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@org.springframework.format.annotation.DateTimeFormat(style = "S-")
|
||||
public MyDate date;
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -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() {
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -74,7 +74,6 @@ public class EnableAsyncTests {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void withAsyncBeanWithExecutorQualifiedByName() throws ExecutionException, InterruptedException {
|
||||
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -1630,6 +1630,7 @@ public class DataBinderTests extends TestCase {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class BeanWithIntegerList {
|
||||
|
||||
private List<Integer> 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<E> extends AbstractList<E> {
|
||||
|
||||
private List<E> list;
|
||||
|
||||
Reference in New Issue
Block a user