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

@@ -31,6 +31,7 @@ import org.springframework.dao.InvalidDataAccessResourceUsageException;
* @author Rod Johnson
* @see InvalidResultSetAccessException
*/
@SuppressWarnings("serial")
public class BadSqlGrammarException extends InvalidDataAccessResourceUsageException {
private String sql;

View File

@@ -25,6 +25,7 @@ import org.springframework.dao.DataAccessResourceFailureException;
*
* @author Rod Johnson
*/
@SuppressWarnings("serial")
public class CannotGetJdbcConnectionException extends DataAccessResourceFailureException {
/**

View File

@@ -26,6 +26,7 @@ import org.springframework.dao.DataRetrievalFailureException;
* @since 2.0
* @see org.springframework.dao.IncorrectResultSizeDataAccessException
*/
@SuppressWarnings("serial")
public class IncorrectResultSetColumnCountException extends DataRetrievalFailureException {
private int expectedCount;

View File

@@ -32,6 +32,7 @@ import org.springframework.dao.InvalidDataAccessResourceUsageException;
* @see BadSqlGrammarException
* @see org.springframework.jdbc.support.rowset.SqlRowSet
*/
@SuppressWarnings("serial")
public class InvalidResultSetAccessException extends InvalidDataAccessResourceUsageException {
private String sql;

View File

@@ -26,6 +26,7 @@ import org.springframework.dao.IncorrectUpdateSemanticsDataAccessException;
* @author Rod Johnson
* @author Juergen Hoeller
*/
@SuppressWarnings("serial")
public class JdbcUpdateAffectedIncorrectNumberOfRowsException extends IncorrectUpdateSemanticsDataAccessException {
/** Number of rows that should have been affected */

View File

@@ -26,6 +26,7 @@ import org.springframework.dao.DataRetrievalFailureException;
* @author Juergen Hoeller
* @since 1.0.2
*/
@SuppressWarnings("serial")
public class LobRetrievalFailureException extends DataRetrievalFailureException {
/**

View File

@@ -32,6 +32,7 @@ import org.springframework.dao.UncategorizedDataAccessException;
* @author Juergen Hoeller
* @see org.springframework.jdbc.core.JdbcTemplate#setIgnoreWarnings
*/
@SuppressWarnings("serial")
public class SQLWarningException extends UncategorizedDataAccessException {
/**

View File

@@ -27,6 +27,7 @@ import org.springframework.dao.UncategorizedDataAccessException;
* @author Rod Johnson
* @author Juergen Hoeller
*/
@SuppressWarnings("serial")
public class UncategorizedSQLException extends UncategorizedDataAccessException {
/** SQL that led to the problem */

View File

@@ -70,6 +70,7 @@ public class NamedParameterJdbcTemplate implements NamedParameterJdbcOperations
private volatile int cacheLimit = DEFAULT_CACHE_LIMIT;
/** Cache of original SQL String to ParsedSql representation */
@SuppressWarnings("serial")
private final Map<String, ParsedSql> parsedSqlCache =
new LinkedHashMap<String, ParsedSql>(DEFAULT_CACHE_LIMIT, 0.75f, true) {
@Override

View File

@@ -99,6 +99,7 @@ import org.springframework.transaction.support.TransactionSynchronizationManager
* @see LazyConnectionDataSourceProxy
* @see org.springframework.jdbc.core.JdbcTemplate
*/
@SuppressWarnings("serial")
public class DataSourceTransactionManager extends AbstractPlatformTransactionManager
implements ResourceTransactionManager, InitializingBean {

View File

@@ -25,6 +25,7 @@ import org.springframework.dao.NonTransientDataAccessException;
* @author Juergen Hoeller
* @since 2.0
*/
@SuppressWarnings("serial")
public class DataSourceLookupFailureException extends NonTransientDataAccessException {
/**

View File

@@ -28,6 +28,7 @@ import org.springframework.core.NestedCheckedException;
* @author Thomas Risberg
* @since 1.0.1
*/
@SuppressWarnings("serial")
public class MetaDataAccessException extends NestedCheckedException {
/**

View File

@@ -25,6 +25,7 @@ import org.springframework.dao.InvalidDataAccessApiUsageException;
* @author Thomas Risberg
* @since 2.5.5
*/
@SuppressWarnings("serial")
public class SqlXmlFeatureNotImplementedException extends InvalidDataAccessApiUsageException {
/**

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

@@ -651,6 +651,7 @@ public class DataSourceJtaTransactionTests extends TestCase {
MockControl conControl = MockControl.createControl(Connection.class);
Connection con = (Connection) conControl.getMock();
@SuppressWarnings("serial")
JtaTransactionManager ptm = new JtaTransactionManager(ut) {
protected void doRegisterAfterCompletionWithJtaTransaction(
JtaTransactionObject txObject, final List synchronizations) {

View File

@@ -1047,6 +1047,7 @@ public class StoredProcedureTests extends AbstractJdbcTests {
}
@SuppressWarnings("serial")
private static class CustomDataException extends DataAccessException {
public CustomDataException(String s) {

View File

@@ -100,6 +100,7 @@ public class SQLErrorCodeSQLExceptionTranslatorTests extends TestCase {
}
@SuppressWarnings("serial")
public void testCustomTranslateMethodTranslation() {
final String TASK = "TASK";
final String SQL = "SQL SELECT *";