Document impossible unchecked cast warnings
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@829388 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ab6b8d8d57
commit
c341321e0c
|
@ -119,6 +119,7 @@ public final class NumberRange extends Range implements Serializable {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked") // this is checked above
|
||||
int compare = ((Comparable<Number>) num1).compareTo(num2);
|
||||
if (compare == 0) {
|
||||
this.min = num1;
|
||||
|
@ -176,7 +177,9 @@ public final class NumberRange extends Range implements Serializable {
|
|||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue