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:
committed by
Chris Beams
parent
7f0aa5cfb2
commit
b0986049a3
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -147,6 +147,7 @@ public abstract class AbstractApplicationContextTests extends AbstractListableBe
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public static class MyEvent extends ApplicationEvent {
|
||||
|
||||
public MyEvent(Object source) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -296,6 +296,7 @@ public class ApplicationContextExpressionTests {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public static class ValueTestBean implements Serializable {
|
||||
|
||||
@Autowired @Value("XXX#{tb0.name}YYY#{mySpecialAttr}ZZZ")
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -312,6 +312,7 @@ public class BshScriptFactoryTests extends TestCase {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private static class MyEvent extends ApplicationEvent {
|
||||
|
||||
public MyEvent(Object source) {
|
||||
|
||||
@@ -20,6 +20,7 @@ package org.springframework.scripting.groovy;
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class TestException extends RuntimeException {
|
||||
|
||||
public TestException(String string) {
|
||||
|
||||
@@ -25,6 +25,7 @@ import test.interceptor.TimestampIntroductionInterceptor;
|
||||
*
|
||||
* @author Rod Johnson
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class TimestampIntroductionAdvisor extends DefaultIntroductionAdvisor {
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.io.Serializable;
|
||||
*
|
||||
* @author Rod Johnson
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class SerializableNopInterceptor extends NopInterceptor implements Serializable {
|
||||
|
||||
/**
|
||||
@@ -42,4 +43,4 @@ public class SerializableNopInterceptor extends NopInterceptor implements Serial
|
||||
++count;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import org.springframework.aop.support.DelegatingIntroductionInterceptor;
|
||||
|
||||
import test.util.TimeStamped;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class TimestampIntroductionInterceptor extends DelegatingIntroductionInterceptor
|
||||
implements TimeStamped {
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ import org.springframework.aop.support.DelegatingIntroductionInterceptor;
|
||||
* @author Rod Johnson
|
||||
* @since 10.07.2003
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class LockMixin extends DelegatingIntroductionInterceptor implements Lockable {
|
||||
|
||||
/** This field demonstrates additional state in the mixin */
|
||||
@@ -61,4 +62,4 @@ public class LockMixin extends DelegatingIntroductionInterceptor implements Lock
|
||||
return super.invoke(invocation);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import org.springframework.aop.support.DefaultIntroductionAdvisor;
|
||||
*
|
||||
* @author Rod Johnson
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class LockMixinAdvisor extends DefaultIntroductionAdvisor {
|
||||
|
||||
public LockMixinAdvisor() {
|
||||
|
||||
@@ -17,8 +17,9 @@
|
||||
package test.mixin;
|
||||
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class LockedException extends RuntimeException {
|
||||
|
||||
public LockedException() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user