commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r903059 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SparseFieldVector.java
Date Tue, 26 Jan 2010 02:53:01 GMT
Author: sebb
Date: Tue Jan 26 02:53:00 2010
New Revision: 903059

URL: http://svn.apache.org/viewvc?rev=903059&view=rev
Log:
Document why OK to suppress unchecked warning
Move tag as close as possible to site of warning

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SparseFieldVector.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SparseFieldVector.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SparseFieldVector.java?rev=903059&r1=903058&r2=903059&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SparseFieldVector.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SparseFieldVector.java
Tue Jan 26 02:53:00 2010
@@ -584,7 +584,7 @@
      * @param length size of the array to build
      * @return a new array
      */
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings("unchecked") // field is type T
     private T[] buildArray(final int length) {
         return (T[]) Array.newInstance(field.getZero().getClass(), length);
     }
@@ -608,7 +608,6 @@
 
 
     /** {@inheritDoc} */
-    @SuppressWarnings("unchecked")
     @Override
     public boolean equals(Object obj) {
 
@@ -620,10 +619,12 @@
             return false;
         }
 
-        if (!(obj instanceof SparseFieldVector)) {
+        if (!(obj instanceof SparseFieldVector<?>)) {
             return false;
         }
 
+        @SuppressWarnings("unchecked") // OK, because "else if" check below ensures that
+                                       // other must be the same type as this
         SparseFieldVector<T> other = (SparseFieldVector<T>) obj;
         if (field == null) {
             if (other.field != null) {



Mime
View raw message