From 35f4fbeeb6feff2fd364f79d845449417d84cc74 Mon Sep 17 00:00:00 2001 From: Luc Maisonobe Date: Thu, 30 Apr 2015 18:35:35 +0200 Subject: [PATCH] Fixed checkstyle and findbugs warnings. --- .../math4/analysis/interpolation/FieldHermiteInterpolator.java | 3 ++- .../apache/commons/math4/geometry/enclosing/EnclosingBall.java | 1 + .../math4/geometry/euclidean/threed/PolyhedronsSet.java | 1 - .../commons/math4/geometry/partitioning/RegionFactory.java | 3 ++- src/test/java/org/apache/commons/math4/PerfTestUtils.java | 2 ++ .../math4/analysis/interpolation/TricubicInterpolatorTest.java | 1 - .../math4/geometry/euclidean/threed/PolyhedronsSetTest.java | 2 -- 7 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/FieldHermiteInterpolator.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/FieldHermiteInterpolator.java index 8945aaeb2..e5e660f7a 100644 --- a/src/main/java/org/apache/commons/math4/analysis/interpolation/FieldHermiteInterpolator.java +++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/FieldHermiteInterpolator.java @@ -87,7 +87,8 @@ public class FieldHermiteInterpolator> { * @throws DimensionMismatchException if derivative structures are inconsistent * @throws NullArgumentException if x is null */ - public void addSamplePoint(final T x, final T[] ... value) + @SafeVarargs + public final void addSamplePoint(final T x, final T[] ... value) throws ZeroException, MathArithmeticException, DimensionMismatchException, NullArgumentException { diff --git a/src/main/java/org/apache/commons/math4/geometry/enclosing/EnclosingBall.java b/src/main/java/org/apache/commons/math4/geometry/enclosing/EnclosingBall.java index 64caf2850..927937705 100644 --- a/src/main/java/org/apache/commons/math4/geometry/enclosing/EnclosingBall.java +++ b/src/main/java/org/apache/commons/math4/geometry/enclosing/EnclosingBall.java @@ -48,6 +48,7 @@ public class EnclosingBall> implements Seria * @param radius radius of the ball * @param support support points used to define the ball */ + @SafeVarargs public EnclosingBall(final P center, final double radius, final P ... support) { this.center = center; this.radius = radius; diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/PolyhedronsSet.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/PolyhedronsSet.java index 744aa9f19..9de30ce1e 100644 --- a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/PolyhedronsSet.java +++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/PolyhedronsSet.java @@ -171,7 +171,6 @@ public class PolyhedronsSet extends AbstractRegion { final Plane pyMax = new Plane(new Vector3D(0, yMax, 0), Vector3D.PLUS_J, tolerance); final Plane pzMin = new Plane(new Vector3D(0, 0, zMin), Vector3D.MINUS_K, tolerance); final Plane pzMax = new Plane(new Vector3D(0, 0, zMax), Vector3D.PLUS_K, tolerance); - @SuppressWarnings("unchecked") final Region boundary = new RegionFactory().buildConvex(pxMin, pxMax, pyMin, pyMax, pzMin, pzMax); return boundary.getTree(false); diff --git a/src/main/java/org/apache/commons/math4/geometry/partitioning/RegionFactory.java b/src/main/java/org/apache/commons/math4/geometry/partitioning/RegionFactory.java index cf9619253..9e32c993f 100644 --- a/src/main/java/org/apache/commons/math4/geometry/partitioning/RegionFactory.java +++ b/src/main/java/org/apache/commons/math4/geometry/partitioning/RegionFactory.java @@ -45,7 +45,8 @@ public class RegionFactory { * @param hyperplanes collection of bounding hyperplanes * @return a new convex region, or null if the collection is empty */ - public Region buildConvex(final Hyperplane ... hyperplanes) { + @SafeVarargs + public final Region buildConvex(final Hyperplane ... hyperplanes) { if ((hyperplanes == null) || (hyperplanes.length == 0)) { return null; } diff --git a/src/test/java/org/apache/commons/math4/PerfTestUtils.java b/src/test/java/org/apache/commons/math4/PerfTestUtils.java index 75afa60f6..f137a47fe 100644 --- a/src/test/java/org/apache/commons/math4/PerfTestUtils.java +++ b/src/test/java/org/apache/commons/math4/PerfTestUtils.java @@ -51,6 +51,7 @@ public class PerfTestUtils { * taken by a single call to the {@code call} method (i.e. the time * taken by each timed block divided by {@code repeatChunk}). */ + @SafeVarargs public static StatisticalSummary[] time(int repeatChunk, int repeatStat, boolean runGC, @@ -95,6 +96,7 @@ public class PerfTestUtils { * * */ + @SafeVarargs public static double[][][] timesAndResults(int repeatChunk, int repeatStat, boolean runGC, diff --git a/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolatorTest.java b/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolatorTest.java index a02e7d530..8c9c57957 100644 --- a/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolatorTest.java +++ b/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolatorTest.java @@ -90,7 +90,6 @@ public final class TricubicInterpolatorTest { double[] zval = new double[] {-12, -8, -5.5, -3, 0, 2.5}; double[][][] fval = new double[xval.length][yval.length][zval.length]; - @SuppressWarnings("unused") TricubicInterpolatingFunction tcf = new TricubicInterpolator().interpolate(xval, yval, zval, fval); // Valid. diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/PolyhedronsSetTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/PolyhedronsSetTest.java index 5c6f93c97..8d4b003cc 100644 --- a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/PolyhedronsSetTest.java +++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/PolyhedronsSetTest.java @@ -103,7 +103,6 @@ public class PolyhedronsSetTest { Vector3D vertex2 = new Vector3D(2, 2, 4); Vector3D vertex3 = new Vector3D(2, 3, 3); Vector3D vertex4 = new Vector3D(1, 3, 4); - @SuppressWarnings("unchecked") PolyhedronsSet tree = (PolyhedronsSet) new RegionFactory().buildConvex( new Plane(vertex3, vertex2, vertex1, 1.0e-10), @@ -138,7 +137,6 @@ public class PolyhedronsSetTest { Vector3D vertex2 = new Vector3D(2.0, 2.4, 4.2); Vector3D vertex3 = new Vector3D(2.8, 3.3, 3.7); Vector3D vertex4 = new Vector3D(1.0, 3.6, 4.5); - @SuppressWarnings("unchecked") PolyhedronsSet tree = (PolyhedronsSet) new RegionFactory().buildConvex( new Plane(vertex3, vertex2, vertex1, 1.0e-10),