Avoid exception swallowing.
Closes
@@ -1050,9 +1050,11 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
return false;
}
- try {
- @SuppressWarnings("unchecked") // May fail, but we ignore ClassCastException
- FieldVector<T> rhs = (FieldVector<T>) other;
+ if (!(other instanceof FieldVector)) {
+ return false;
+ }
+
+ FieldVector rhs = (FieldVector) other;
if (data.length != rhs.getDimension()) {
return false;
}
@@ -1063,10 +1065,6 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
}
}
return true;
- } catch (ClassCastException ex) {
- // ignore exception
- return false;
- }
}
/**
