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

@@ -23,6 +23,7 @@ import org.springframework.transaction.support.DefaultTransactionStatus;
* @author Rod Johnson
* @author Juergen Hoeller
*/
@SuppressWarnings("serial")
public class CallCountingTransactionManager extends AbstractPlatformTransactionManager {
public TransactionDefinition lastDefinition;

View File

@@ -23,6 +23,7 @@ import org.springframework.transaction.support.DefaultTransactionStatus;
* @author Juergen Hoeller
* @since 29.04.2003
*/
@SuppressWarnings("serial")
class TestTransactionManager extends AbstractPlatformTransactionManager {
private static final Object TRANSACTION = "transaction";

View File

@@ -181,6 +181,7 @@ public class TransactionSupportTests extends TestCase {
}
}
@SuppressWarnings("serial")
public void testTransactionTemplateWithRollbackException() {
final TransactionSystemException tex = new TransactionSystemException("system exception");
TestTransactionManager tm = new TestTransactionManager(false, true) {

View File

@@ -329,6 +329,7 @@ public class AnnotationTransactionAttributeSourceTests {
}
@SuppressWarnings("serial")
public static class TestBean1 implements ITestBean, Serializable {
private String name;

View File

@@ -84,6 +84,7 @@ public class AnnotationDrivenTests extends TestCase {
}
@SuppressWarnings("serial")
public static class TransactionCheckingInterceptor implements MethodInterceptor, Serializable {
public Object invoke(MethodInvocation methodInvocation) throws Throwable {

View File

@@ -24,6 +24,7 @@ import org.springframework.transaction.annotation.Transactional;
* @author Rob Harrop
* @author Juergen Hoeller
*/
@SuppressWarnings("serial")
public class TransactionalService implements Serializable {
@Transactional("synch")

View File

@@ -381,6 +381,7 @@ public abstract class AbstractTransactionAspectTests extends TestCase {
* @param ex exception to be thrown by the target
* @param shouldRollback whether this should cause a transaction rollback
*/
@SuppressWarnings("serial")
protected void doTestRollbackOnException(
final Exception ex, final boolean shouldRollback, boolean rollbackException) throws Exception {

View File

@@ -108,6 +108,7 @@ public class TransactionInterceptorTests extends AbstractTransactionAspectTests
/**
* We won't use this: we just want to know it's serializable.
*/
@SuppressWarnings("serial")
public static class SerializableTransactionManager implements PlatformTransactionManager, Serializable {
public TransactionStatus getTransaction(TransactionDefinition definition) throws TransactionException {