Fix [serial] compiler warnings

Fix serialization warnings by applying @SuppressWarnings("serial")
when appropriate.

In certain cases and for unknown reasons, a correctly-placed
@SuppressWarnings("serial") annotation will fix the warning at the
javac level (i.e. the Gradle command-line), but will produce an
"unnecessary @SuppressWarnings" warning within Eclipse. In these
cases, a private static final serialVersionUID field has been added
with the default value of 1L.
This commit is contained in:
Phillip Webb
2012-12-19 14:35:57 -08:00
committed by Chris Beams
parent 7f0aa5cfb2
commit b0986049a3
550 changed files with 705 additions and 36 deletions

View File

@@ -21,6 +21,7 @@ import org.springframework.core.enums.ShortCodedLabeledEnum;
/**
* @author Rob Harrop
*/
@SuppressWarnings("serial")
public class Colour extends ShortCodedLabeledEnum {
public static final Colour RED = new Colour(0, "RED");
@@ -32,4 +33,4 @@ public class Colour extends ShortCodedLabeledEnum {
super(code, label);
}
}
}

View File

@@ -25,6 +25,7 @@ import org.springframework.beans.factory.DisposableBean;
* @author Juergen Hoeller
* @since 21.08.2003
*/
@SuppressWarnings("serial")
public class DerivedTestBean extends TestBean implements Serializable, BeanNameAware, DisposableBean {
private String beanName;
@@ -82,4 +83,4 @@ public class DerivedTestBean extends TestBean implements Serializable, BeanNameA
return destroyed;
}
}
}

View File

@@ -25,6 +25,7 @@ import org.springframework.util.ObjectUtils;
*
* @author Rod Johnson
*/
@SuppressWarnings("serial")
public class SerializablePerson implements Person, Serializable {
private String name;
@@ -61,4 +62,4 @@ public class SerializablePerson implements Person, Serializable {
return p.age == age && ObjectUtils.nullSafeEquals(name, p.name);
}
}
}

View File

@@ -28,6 +28,7 @@ import org.springframework.beans.factory.ObjectFactory;
/**
* @author Juergen Hoeller
*/
@SuppressWarnings("serial")
public class SimpleMapScope implements Scope, Serializable {
private final Map map = new HashMap();

View File

@@ -147,6 +147,7 @@ public abstract class AbstractApplicationContextTests extends AbstractListableBe
}
@SuppressWarnings("serial")
public static class MyEvent extends ApplicationEvent {
public MyEvent(Object source) {

View File

@@ -190,6 +190,7 @@ public class ApplicationContextEventTests {
}
@SuppressWarnings("serial")
public static class MyEvent extends ApplicationEvent {
public MyEvent(Object source) {
@@ -198,6 +199,7 @@ public class ApplicationContextEventTests {
}
@SuppressWarnings("serial")
public static class MyOtherEvent extends ApplicationEvent {
public MyOtherEvent(Object source) {

View File

@@ -120,6 +120,7 @@ public class EventPublicationInterceptorTests {
}
@SuppressWarnings("serial")
public static class TestEvent extends ApplicationEvent {
public TestEvent(Object source) {
@@ -128,6 +129,7 @@ public class EventPublicationInterceptorTests {
}
@SuppressWarnings("serial")
public static final class TestEventWithNoValidOneArgObjectCtor extends ApplicationEvent {
public TestEventWithNoValidOneArgObjectCtor() {

View File

@@ -296,6 +296,7 @@ public class ApplicationContextExpressionTests {
}
@SuppressWarnings("serial")
public static class ValueTestBean implements Serializable {
@Autowired @Value("XXX#{tb0.name}YYY#{mySpecialAttr}ZZZ")

View File

@@ -56,6 +56,7 @@ public class ScheduledExecutorFactoryBeanTests {
}
@Test
@SuppressWarnings("serial")
public void testShutdownNowIsPropagatedToTheExecutorOnDestroy() throws Exception {
MockControl mockScheduledExecutorService = MockControl.createNiceControl(ScheduledExecutorService.class);
final ScheduledExecutorService executor = (ScheduledExecutorService) mockScheduledExecutorService.getMock();
@@ -78,6 +79,7 @@ public class ScheduledExecutorFactoryBeanTests {
}
@Test
@SuppressWarnings("serial")
public void testShutdownIsPropagatedToTheExecutorOnDestroy() throws Exception {
MockControl mockScheduledExecutorService = MockControl.createNiceControl(ScheduledExecutorService.class);
final ScheduledExecutorService executor = (ScheduledExecutorService) mockScheduledExecutorService.getMock();
@@ -228,6 +230,7 @@ public class ScheduledExecutorFactoryBeanTests {
}
@Test
@SuppressWarnings("serial")
public void testSettingThreadFactoryToNullForcesUseOfDefaultButIsOtherwiseCool() throws Exception {
ScheduledExecutorFactoryBean factory = new ScheduledExecutorFactoryBean() {
protected ScheduledExecutorService createExecutor(int poolSize, ThreadFactory threadFactory, RejectedExecutionHandler rejectedExecutionHandler) {
@@ -244,6 +247,7 @@ public class ScheduledExecutorFactoryBeanTests {
}
@Test
@SuppressWarnings("serial")
public void testSettingRejectedExecutionHandlerToNullForcesUseOfDefaultButIsOtherwiseCool() throws Exception {
ScheduledExecutorFactoryBean factory = new ScheduledExecutorFactoryBean() {
protected ScheduledExecutorService createExecutor(int poolSize, ThreadFactory threadFactory, RejectedExecutionHandler rejectedExecutionHandler) {

View File

@@ -312,6 +312,7 @@ public class BshScriptFactoryTests extends TestCase {
}
@SuppressWarnings("serial")
private static class MyEvent extends ApplicationEvent {
public MyEvent(Object source) {

View File

@@ -20,6 +20,7 @@ package org.springframework.scripting.groovy;
* @author Dave Syer
*
*/
@SuppressWarnings("serial")
public class TestException extends RuntimeException {
public TestException(String string) {