[GEOMETRY-54] - Cleanup Checkstyle Reported issues
diff --git a/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/Vector.java b/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/Vector.java
index 873e24e..a55b1b7 100644
--- a/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/Vector.java
+++ b/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/Vector.java
@@ -96,9 +96,9 @@
/** Get a normalized vector aligned with the instance. The returned
* vector has a magnitude of 1.
* @return a new normalized vector
- * @exception IllegalNormException if the norm is zero, NaN, or infinite
+ * @throws IllegalNormException if the norm is zero, NaN, or infinite
*/
- V normalize();
+ V normalize() throws IllegalNormException;
/** Multiply the instance by a scalar.
* @param a scalar
@@ -131,7 +131,7 @@
/** Compute the angular separation between two vectors in radians.
* @param v other vector
* @return angular separation between this instance and v in radians
- * @exception IllegalNormException if either vector has a zero, NaN, or infinite norm
+ * @throws IllegalNormException if either vector has a zero, NaN, or infinite norm
*/
- double angle(V v);
+ double angle(V v) throws IllegalNormException;
}
diff --git a/commons-geometry-core/src/test/java/org/apache/commons/geometry/core/precision/DoublePrecisionContextTest.java b/commons-geometry-core/src/test/java/org/apache/commons/geometry/core/precision/DoublePrecisionContextTest.java
index 80d9f8d..aff6a16 100644
--- a/commons-geometry-core/src/test/java/org/apache/commons/geometry/core/precision/DoublePrecisionContextTest.java
+++ b/commons-geometry-core/src/test/java/org/apache/commons/geometry/core/precision/DoublePrecisionContextTest.java
@@ -108,13 +108,13 @@
@Test
public void testCompare_wrapper() {
// act/assert
- Assert.assertEquals(0, ctx.compare(new Double(1), new Double(1)));
- Assert.assertEquals(-1, ctx.compare(new Double(1), new Double(2)));
- Assert.assertEquals(1, ctx.compare(new Double(2), new Double(1)));
+ Assert.assertEquals(0, ctx.compare(Double.valueOf(1), Double.valueOf(1)));
+ Assert.assertEquals(-1, ctx.compare(Double.valueOf(1), Double.valueOf(2)));
+ Assert.assertEquals(1, ctx.compare(Double.valueOf(2), Double.valueOf(1)));
- Assert.assertEquals(0, ctx.compare(new Double(-1), new Double(-1)));
- Assert.assertEquals(1, ctx.compare(new Double(-1), new Double(-2)));
- Assert.assertEquals(-1, ctx.compare(new Double(-2), new Double(-1)));
+ Assert.assertEquals(0, ctx.compare(Double.valueOf(-1), Double.valueOf(-1)));
+ Assert.assertEquals(1, ctx.compare(Double.valueOf(-1), Double.valueOf(-2)));
+ Assert.assertEquals(-1, ctx.compare(Double.valueOf(-2), Double.valueOf(-1)));
}
private static class StubContext extends DoublePrecisionContext {
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/AffineTransformMatrix1D.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/AffineTransformMatrix1D.java
index 1a6aaf9..6056700 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/AffineTransformMatrix1D.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/AffineTransformMatrix1D.java
@@ -201,7 +201,7 @@
* @return inverse transform
* @throws NonInvertibleTransformException if the transform matrix cannot be inverted
*/
- public AffineTransformMatrix1D inverse() {
+ public AffineTransformMatrix1D inverse() throws NonInvertibleTransformException {
final double det = this.m00;
@@ -356,7 +356,7 @@
* @throws NonInvertibleTransformException if the element is not valid for use
* in calculating a matrix inverse, ie if it is NaN or infinite.
*/
- private static void validateElementForInverse(final double element) {
+ private static void validateElementForInverse(final double element) throws NonInvertibleTransformException {
if (!Double.isFinite(element)) {
throw new NonInvertibleTransformException("Transform is not invertible; invalid matrix element: " + element);
}
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/AffineTransformMatrix3D.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/AffineTransformMatrix3D.java
index cd25f7b..ad38a5a 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/AffineTransformMatrix3D.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/AffineTransformMatrix3D.java
@@ -316,7 +316,7 @@
* @return inverse transform
* @throws NonInvertibleTransformException if the transform matrix cannot be inverted
*/
- public AffineTransformMatrix3D inverse() {
+ public AffineTransformMatrix3D inverse() throws NonInvertibleTransformException {
// Our full matrix is 4x4 but we can significantly reduce the amount of computations
// needed here since we know that our last row is [0 0 0 1].
@@ -609,7 +609,7 @@
* @throws NonInvertibleTransformException if the element is not valid for use
* in calculating a matrix inverse, ie if it is NaN or infinite.
*/
- private static void validateElementForInverse(final double element) {
+ private static void validateElementForInverse(final double element) throws NonInvertibleTransformException {
if (!Double.isFinite(element)) {
throw new NonInvertibleTransformException("Transform is not invertible; invalid matrix element: " + element);
}
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/AffineTransformMatrix2D.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/AffineTransformMatrix2D.java
index 2192f43..d5ffbfd 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/AffineTransformMatrix2D.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/AffineTransformMatrix2D.java
@@ -276,7 +276,7 @@
* @return inverse transform
* @throws NonInvertibleTransformException if the transform matrix cannot be inverted
*/
- public AffineTransformMatrix2D inverse() {
+ public AffineTransformMatrix2D inverse() throws NonInvertibleTransformException {
// Our full matrix is 3x3 but we can significantly reduce the amount of computations
// needed here since we know that our last row is [0 0 1].
@@ -559,7 +559,7 @@
* @throws NonInvertibleTransformException if the element is not valid for use
* in calculating a matrix inverse, ie if it is NaN or infinite.
*/
- private static void validateElementForInverse(final double element) {
+ private static void validateElementForInverse(final double element) throws NonInvertibleTransformException {
if (!Double.isFinite(element)) {
throw new NonInvertibleTransformException("Transform is not invertible; invalid matrix element: " + element);
}