You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2009/10/24 17:38:31 UTC

svn commit: r829388 - /commons/proper/lang/trunk/src/java/org/apache/commons/lang/math/NumberRange.java

Author: sebb
Date: Sat Oct 24 15:38:31 2009
New Revision: 829388

URL: http://svn.apache.org/viewvc?rev=829388&view=rev
Log:
Document impossible unchecked cast warnings

Modified:
    commons/proper/lang/trunk/src/java/org/apache/commons/lang/math/NumberRange.java

Modified: commons/proper/lang/trunk/src/java/org/apache/commons/lang/math/NumberRange.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/java/org/apache/commons/lang/math/NumberRange.java?rev=829388&r1=829387&r2=829388&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/java/org/apache/commons/lang/math/NumberRange.java (original)
+++ commons/proper/lang/trunk/src/java/org/apache/commons/lang/math/NumberRange.java Sat Oct 24 15:38:31 2009
@@ -119,6 +119,7 @@
             }
         }
         
+        @SuppressWarnings("unchecked") // this is checked above
         int compare = ((Comparable<Number>) num1).compareTo(num2);
         if (compare == 0) {
             this.min = num1;
@@ -176,7 +177,9 @@
         if (number.getClass() != min.getClass()) {
             throw new IllegalArgumentException("The number must be of the same type as the range numbers");
         }
+        @SuppressWarnings("unchecked") // this was checked in the ctor
         int compareMin = ((Comparable<Number>) min).compareTo(number);
+        @SuppressWarnings("unchecked") // this was checked in the ctor
         int compareMax = ((Comparable<Number>) max).compareTo(number);
         return compareMin <= 0 && compareMax >= 0;
     }