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

@@ -450,6 +450,7 @@ public class HttpInvokerTests extends TestCase {
}
@SuppressWarnings("serial")
private static class TestRemoteInvocation extends RemoteInvocation {
public TestRemoteInvocation(MethodInvocation methodInvocation) {
@@ -458,6 +459,7 @@ public class HttpInvokerTests extends TestCase {
}
@SuppressWarnings("serial")
private static class TestRemoteInvocationWrapper implements Serializable {
private final RemoteInvocation remoteInvocation;
@@ -468,6 +470,7 @@ public class HttpInvokerTests extends TestCase {
}
@SuppressWarnings("serial")
private static class TestRemoteInvocationResultWrapper implements Serializable {
private final RemoteInvocationResult remoteInvocationResult;

View File

@@ -22,6 +22,7 @@ import javax.xml.ws.WebFault;
* @author Juergen Hoeller
*/
@WebFault
@SuppressWarnings("serial")
public class OrderNotFoundException extends Exception {
private String faultInfo;

View File

@@ -264,6 +264,7 @@ public class RestTemplateIntegrationTests {
}
/** Servlet that sets the given status code. */
@SuppressWarnings("serial")
private static class StatusCodeServlet extends GenericServlet {
private final int sc;
@@ -279,6 +280,7 @@ public class RestTemplateIntegrationTests {
}
/** Servlet that returns an error message for a given status code. */
@SuppressWarnings("serial")
private static class ErrorServlet extends GenericServlet {
private final int sc;
@@ -293,6 +295,7 @@ public class RestTemplateIntegrationTests {
}
}
@SuppressWarnings("serial")
private static class GetServlet extends HttpServlet {
private final byte[] buf;
@@ -315,6 +318,7 @@ public class RestTemplateIntegrationTests {
}
}
@SuppressWarnings("serial")
private static class PostServlet extends HttpServlet {
private final String s;
@@ -347,6 +351,7 @@ public class RestTemplateIntegrationTests {
}
}
@SuppressWarnings("serial")
private static class UriServlet extends HttpServlet {
@Override
@@ -357,6 +362,7 @@ public class RestTemplateIntegrationTests {
}
}
@SuppressWarnings("serial")
private static class MultipartServlet extends HttpServlet {
@Override

View File

@@ -34,6 +34,7 @@ public class ServletRequestAttributesTests {
private static final String KEY = "ThatThingThatThing";
@SuppressWarnings("serial")
private static final Serializable VALUE = new Serializable() {
};

View File

@@ -175,6 +175,7 @@ public class SessionScopeTests extends TestCase {
}
@SuppressWarnings("serial")
private static class CustomSerializableDestructionAwareBeanPostProcessor
implements DestructionAwareBeanPostProcessor, Serializable {

View File

@@ -36,6 +36,7 @@ public class DelegatingPhaseListenerTests extends TestCase {
private StaticListableBeanFactory beanFactory;
private DelegatingPhaseListenerMulticaster delPhaseListener;
@SuppressWarnings("serial")
protected void setUp() {
facesContext = new MockFacesContext();
beanFactory = new StaticListableBeanFactory();
@@ -80,6 +81,7 @@ public class DelegatingPhaseListenerTests extends TestCase {
}
@SuppressWarnings("serial")
public static class TestListener implements PhaseListener {
boolean beforeCalled = false;

View File

@@ -397,6 +397,7 @@ public class CommonsMultipartResolverTests {
}
@SuppressWarnings("serial")
private static class MockFileItem implements FileItem {
private String fieldName;

View File

@@ -133,14 +133,17 @@ public final class TagUtilsTests {
TagUtils.assertHasAncestorOfType(a, TagC.class, "a", "c");
}
@SuppressWarnings("serial")
private static final class TagA extends TagSupport {
}
@SuppressWarnings("serial")
private static final class TagB extends TagSupport {
}
@SuppressWarnings("serial")
private static final class TagC extends TagSupport {
}