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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import java.io.Serializable;
|
||||
* @author Juergen Hoeller
|
||||
* @since 21.08.2003
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class DerivedTestBean extends TestBean implements Serializable {
|
||||
|
||||
private String beanName;
|
||||
@@ -79,4 +80,4 @@ public class DerivedTestBean extends TestBean implements Serializable {
|
||||
return destroyed;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ public class AttributeAccessorSupportTests extends TestCase {
|
||||
|
||||
private AttributeAccessor attributeAccessor;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
protected void setUp() throws Exception {
|
||||
this.attributeAccessor = new AttributeAccessorSupport() {
|
||||
};
|
||||
|
||||
@@ -87,18 +87,23 @@ public class ExceptionDepthComparatorTests {
|
||||
return ExceptionDepthComparator.findClosestMatch(Arrays.asList(classes), new TargetException());
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class HighestDepthException extends Throwable {
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class LowestDepthException extends HighestDepthException {
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class TargetException extends LowestDepthException {
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class SameDepthException extends LowestDepthException {
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class NoDepthException extends TargetException {
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ import junit.framework.Assert;
|
||||
*/
|
||||
public class NestedExceptionTests extends TestCase {
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public void testNestedRuntimeExceptionWithNoRootCause() {
|
||||
String mesg = "mesg of mine";
|
||||
// Making a class abstract doesn't _really_ prevent instantiation :-)
|
||||
@@ -44,6 +45,7 @@ public class NestedExceptionTests extends TestCase {
|
||||
assertFalse(stackTrace.indexOf(mesg) == -1);
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public void testNestedRuntimeExceptionWithRootCause() {
|
||||
String myMessage = "mesg for this exception";
|
||||
String rootCauseMesg = "this is the obscure message of the root cause";
|
||||
@@ -64,6 +66,7 @@ public class NestedExceptionTests extends TestCase {
|
||||
assertFalse(stackTrace.indexOf(rootCauseMesg) == -1);
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public void testNestedCheckedExceptionWithNoRootCause() {
|
||||
String mesg = "mesg of mine";
|
||||
// Making a class abstract doesn't _really_ prevent instantiation :-)
|
||||
@@ -80,6 +83,7 @@ public class NestedExceptionTests extends TestCase {
|
||||
assertFalse(stackTrace.indexOf(mesg) == -1);
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public void testNestedCheckedExceptionWithRootCause() {
|
||||
String myMessage = "mesg for this exception";
|
||||
String rootCauseMesg = "this is the obscure message of the root cause";
|
||||
|
||||
@@ -240,6 +240,7 @@ public class DefaultConversionTests {
|
||||
conversionService.convert(Integer.valueOf(1), CustomNumber.class);
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public static class CustomNumber extends Number {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -217,6 +217,7 @@ public class MapToMapConverterTests {
|
||||
assertEquals(NoDefaultConstructorMap.class, result.getClass());
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public static class NoDefaultConstructorMap<K, V> extends HashMap<K, V> {
|
||||
public NoDefaultConstructorMap(Map<? extends K, ? extends V> m) {
|
||||
super(m);
|
||||
|
||||
@@ -118,6 +118,7 @@ public class LabeledEnumTests extends TestCase {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private static class Other extends StaticLabeledEnum {
|
||||
|
||||
public static final Other THING1 = new Other(1, "Thing1");
|
||||
@@ -130,6 +131,7 @@ public class LabeledEnumTests extends TestCase {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private static class Dog extends StaticLabeledEnum {
|
||||
|
||||
public static final Dog GOLDEN_RETRIEVER = new Dog(11, null) {
|
||||
@@ -159,6 +161,7 @@ public class LabeledEnumTests extends TestCase {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private static abstract class ValuedEnum extends StaticLabeledEnum {
|
||||
|
||||
public static final ValuedEnum ONE = new ValuedEnum(1, "one") {
|
||||
|
||||
@@ -94,6 +94,7 @@ public class CachingMapDecoratorTests extends TestCase {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private static class MyCachingMap extends CachingMapDecorator<String, String> {
|
||||
|
||||
private boolean createCalled;
|
||||
|
||||
@@ -144,6 +144,7 @@ public abstract class AbstractStaxXMLReaderTestCase {
|
||||
protected abstract AbstractStaxXMLReader createStaxXmlReader(InputStream inputStream) throws XMLStreamException;
|
||||
|
||||
/** Easymock {@code AbstractMatcher} implementation that matches SAX arguments. */
|
||||
@SuppressWarnings("serial")
|
||||
protected static class SaxArgumentMatcher extends AbstractMatcher {
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user