db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r1484920 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/jdbc/ engine/org/apache/derby/impl/load/ engine/org/apache/derby/impl/services/locks/ engine/org/apache/derby/impl/sql/compile/ testing/org/apache/derbyTesting/functionTe...
Date Tue, 21 May 2013 19:51:02 GMT
Author: kahatlen
Date: Tue May 21 19:51:02 2013
New Revision: 1484920

URL: http://svn.apache.org/r1484920
Log:
DERBY-5840: Clean up compiler warnings introduced by using Java 5 language features

Stop suppressing some unchecked conversion warnings. Make the
conversions checked instead.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/load/ColumnInfo.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/services/locks/Deadlock.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateAliasNode.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/VersionCombinationConfigurator.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/Wrapper41Test.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/management/MBeanTest.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java?rev=1484920&r1=1484919&r2=1484920&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java Tue May
21 19:51:02 2013
@@ -45,7 +45,6 @@ import org.apache.derby.iapi.error.SQLWa
 import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.services.i18n.MessageService;
 import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
-import org.apache.derby.iapi.sql.execute.ExecutionContext;
 import org.apache.derby.iapi.sql.dictionary.DataDictionary;
 import org.apache.derby.iapi.store.access.XATransactionController;
 import org.apache.derby.iapi.store.access.TransactionController;
@@ -78,6 +77,7 @@ import java.sql.SQLPermission;
 import java.sql.SQLWarning;
 import java.sql.Savepoint;
 import java.sql.Statement;
+import java.util.Collections;
 
 import java.util.HashSet;
 import java.util.Map;
@@ -3863,11 +3863,10 @@ public abstract class EmbedConnection im
      * @return type map for this connection
      * @exception SQLException if a database access error occurs
      */
-    @SuppressWarnings("unchecked")
     public final Map<String, Class<?>> getTypeMap() throws SQLException {
         checkIfClosed();
 		// just return an immuntable empty map
-		return java.util.Collections.EMPTY_MAP;
+        return Collections.emptyMap();
     }
     
     /**
@@ -3891,7 +3890,7 @@ public abstract class EmbedConnection im
      *
      * @param  interfaces a Class defining an interface
      * @return an object that implements the interface
-     * @throws java.sql.SQLExption if no object if found that implements the 
+     * @throws SQLException if no object is found that implements the
      * interface
      */
     public <T> T unwrap(java.lang.Class<T> interfaces) 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/load/ColumnInfo.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/load/ColumnInfo.java?rev=1484920&r1=1484919&r2=1484920&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/load/ColumnInfo.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/load/ColumnInfo.java Tue May 21
19:51:02 2013
@@ -528,13 +528,15 @@ class ColumnInfo {
         ( String columnTypeNamesString, int noOfColumns )
         throws Exception
     {
-        @SuppressWarnings({"unchecked"})
-        ArrayList<String> list = (ArrayList<String>) ImportAbstract.destringifyObject(
columnTypeNamesString );
+        ArrayList list = (ArrayList)
+                ImportAbstract.destringifyObject( columnTypeNamesString );
 
         String[] retval = new String[ list.size() ];
 
-        list.toArray( retval );
-        
+        for (int i = 0; i < retval.length; i++) {
+            retval[i] = (String) list.get(i);
+        }
+
         return retval;
     }
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/services/locks/Deadlock.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/services/locks/Deadlock.java?rev=1484920&r1=1484919&r2=1484920&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/services/locks/Deadlock.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/services/locks/Deadlock.java Tue
May 21 19:51:02 2013
@@ -167,8 +167,7 @@ outer:	for (;;) {
 				break outer;
 			}
 
-            @SuppressWarnings("unchecked")
-			List<Object> grants = (List<Object>) chain.peek();
+			List grants = (List) chain.peek();
 			if (grants.isEmpty()) {
                 // All granted locks in this lock control have been examined.
 				// pop this list of granted locks and back to the previous one

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateAliasNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateAliasNode.java?rev=1484920&r1=1484919&r2=1484920&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateAliasNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateAliasNode.java
Tue May 21 19:51:02 2013
@@ -127,7 +127,6 @@ public class CreateAliasNode extends DDL
      *
 	 * @exception StandardException		Thrown on error
 	 */
-    @SuppressWarnings("unchecked")
 	public void init(
 						Object aliasName,
 						Object targetObject,
@@ -212,14 +211,13 @@ public class CreateAliasNode extends DDL
 				
 				if (paramCount != 0) {
 
-                    names = (String[]) ((List<String>) parameters[0]).toArray(
-                            new String[paramCount]);
-
-                    types = (TypeDescriptor[]) ((List<TypeDescriptor>) parameters[1]).toArray(
-                            new TypeDescriptor[paramCount]);
-
+                    names = new String[paramCount];
+                    types = new TypeDescriptor[paramCount];
 					modes = new int[paramCount];
+
 					for (int i = 0; i < paramCount; i++) {
+                        names[i] = (String) ((List) parameters[0]).get(i);
+                        types[i] = (TypeDescriptor) ((List) parameters[1]).get(i);
                         int currentMode =  ((Integer) (((List) parameters[2]).get(i))).intValue();
                         modes[i] = currentMode;
   

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/VersionCombinationConfigurator.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/VersionCombinationConfigurator.java?rev=1484920&r1=1484919&r2=1484920&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/VersionCombinationConfigurator.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/VersionCombinationConfigurator.java
Tue May 21 19:51:02 2013
@@ -305,15 +305,9 @@ public class VersionCombinationConfigura
     /**
      * Sorts and filters out distributions based on the configurator settings.
      *
-     * We suppress warnings here because DerbyDistribution needs to
-     * implement Comparable<DerbyVersion> and not just Comparable. But DerbyDistribution
-     * lives in a package which has to compile at level 1.4 and so cannot be
-     * declared that way.
-     *
      * @param distributions list of distributions to filter
      * @return A filtered list of distributions.
      */
-    @SuppressWarnings("unchecked")
     private List<DerbyDistribution> sortAndFilterVersions(
             List<DerbyDistribution> distributions) {
         // Sort the releases based on the version number (highest first).

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/Wrapper41Test.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/Wrapper41Test.java?rev=1484920&r1=1484919&r2=1484920&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/Wrapper41Test.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/Wrapper41Test.java
Tue May 21 19:51:02 2013
@@ -116,11 +116,10 @@ public  class   Wrapper41Test   extends 
         vetWrappedString( wrapper, 18, "VARCHARCOL" );
         vetWrappedBinary( wrapper, 19, "VARCHARFORBITDATACOL" );
     }
-    @SuppressWarnings("unchecked")
     private void    vetWrappedNull( Wrapper41 wrapper ) throws Exception
     {
             try {
-                wrapper.getObject( 1, (Class) null );
+                wrapper.getObject( 1, (Class<?>) null );
                 fail( "Did not expect to get a result for a null class type." );
             }
             catch (SQLException e)
@@ -132,7 +131,7 @@ public  class   Wrapper41Test   extends 
             if ( wrapper.getWrappedObject() instanceof CallableStatement ) { return; }
             
             try {
-                wrapper.getObject( "BIGINTCOL", (Class) null );
+                wrapper.getObject( "BIGINTCOL", (Class<?>) null );
                 fail( "Did not expect to get a result for a null class type." );
             }
             catch (SQLException e)
@@ -512,7 +511,6 @@ public  class   Wrapper41Test   extends 
              );
     }
 
-    @SuppressWarnings("unchecked")
     private void    vetWrapperOK
         ( Wrapper41 wrapper, int colID, String colName, Object expectedValue, Class[] supportedCoercions
)
         throws Exception
@@ -520,7 +518,7 @@ public  class   Wrapper41Test   extends 
         int coercionCount = supportedCoercions.length;
         for ( int i = 0; i < coercionCount; i++ )
         {
-            Class   candidate = supportedCoercions[ i ];
+            Class<?> candidate = supportedCoercions[ i ];
             vetCandidate( candidate, expectedValue, wrapper.getObject( colID, candidate )
);
             
             // you can only retrieve a LOB once
@@ -531,8 +529,7 @@ public  class   Wrapper41Test   extends 
             { vetCandidate( candidate, expectedValue, wrapper.getObject( colName, candidate
) ); }
         }
     }
-    @SuppressWarnings("unchecked")
-    private void    vetCandidate( Class candidate, Object expectedValue, Object actualValue
)
+    private void vetCandidate( Class<?> candidate, Object expectedValue, Object actualValue
)
         throws Exception
     {
         if ( actualValue != null ) { assertTrue( candidate.getName(), candidate.isAssignableFrom(
actualValue.getClass( ) ) ); }
@@ -582,7 +579,6 @@ public  class   Wrapper41Test   extends 
     {
         vetCoercionError( wrapper, colID, colName, unsupportedCoercions, UNSUPPORTED_COERCION
);
     }
-    @SuppressWarnings("unchecked")
     private void    vetCoercionError
         ( Wrapper41 wrapper, int colID, String colName, Class[] unsupportedCoercions, String
expectedSQLState )
         throws Exception
@@ -593,7 +589,7 @@ public  class   Wrapper41Test   extends 
         int coercionCount = unsupportedCoercions.length;
         for ( int i = 0; i < coercionCount; i++ )
         {
-            Class   candidate = unsupportedCoercions[ i ];
+            Class<?> candidate = unsupportedCoercions[ i ];
 
             try {
                 wrapper.getObject( colID, candidate );

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/management/MBeanTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/management/MBeanTest.java?rev=1484920&r1=1484919&r2=1484920&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/management/MBeanTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/management/MBeanTest.java
Tue May 21 19:51:02 2013
@@ -252,15 +252,14 @@ abstract class MBeanTest extends BaseJDB
      * @return Set of ObjectNames for all of Derby's registered MBeans.
      * @throws Exception
      */
-    @SuppressWarnings("unchecked")
     protected Set<ObjectName> getDerbyDomainMBeans() throws Exception
     {
         final ObjectName derbyDomain = new ObjectName("org.apache.derby:*");
         final MBeanServerConnection serverConn = getMBeanServerConnection(); 
         
-        return  (Set<ObjectName>) AccessController.doPrivileged(
-            new PrivilegedExceptionAction<Object>() {
-                public Object run() throws IOException {
+        return AccessController.doPrivileged(
+            new PrivilegedExceptionAction<Set<ObjectName>>() {
+                public Set<ObjectName> run() throws IOException {
                     return serverConn.queryNames(derbyDomain, null);
                }   
             }



Mime
View raw message