From cc11892672de320e42e6a3d2ef6173963babecfa Mon Sep 17 00:00:00 2001 From: Lee Rhodes Date: Tue, 6 May 2025 17:44:53 -0700 Subject: [PATCH 1/2] Add "final" to method parameters where they were missing. --- pom.xml | 14 +++++++------- .../quantilescommon/DoublesSortedView.java | 4 ++-- .../quantilescommon/FloatsSortedView.java | 4 ++-- .../quantilescommon/LongsSortedView.java | 4 ++-- .../quantilescommon/PartitioningFeature.java | 4 ++-- .../quantilescommon/QuantilesDoublesAPI.java | 12 ++++++------ .../quantilescommon/QuantilesFloatsAPI.java | 12 ++++++------ .../quantilescommon/QuantilesGenericAPI.java | 12 ++++++------ .../quantilescommon/QuantilesLongsAPI.java | 12 ++++++------ .../theta/ConcurrentSharedThetaSketch.java | 2 +- 10 files changed, 40 insertions(+), 40 deletions(-) diff --git a/pom.xml b/pom.xml index 84e032947..a9858526a 100644 --- a/pom.xml +++ b/pom.xml @@ -94,11 +94,11 @@ under the License. 3.6.3 - 21 - --enable-preview + 22 + ${java.version} ${java.version} - -Xmx4g -Duser.language=en -Duser.country=US -Dfile.encoding=UTF-8 ${jvm-ffm-flag} + -Xmx4g -Duser.language=en -Duser.country=US -Dfile.encoding=UTF-8 ${jvm-arguments} UTF-8 ${charset.encoding} ${charset.encoding} @@ -164,7 +164,7 @@ under the License. ${maven-compiler-plugin.version} - ${jvm-ffm-flag} + ${jvm-arguments} @@ -190,7 +190,7 @@ under the License. - [21,) + [22,) [${maven.version},4.0.0) @@ -239,7 +239,7 @@ under the License. public all,-missing - ${jvm-ffm-flag} + ${jvm-arguments} @@ -285,7 +285,7 @@ under the License. maven-surefire-plugin ${maven-surefire-failsafe-plugins.version} - ${jvm-ffm-flag} + ${jvm-arguments} false false true diff --git a/src/main/java/org/apache/datasketches/quantilescommon/DoublesSortedView.java b/src/main/java/org/apache/datasketches/quantilescommon/DoublesSortedView.java index 1427f6279..47bad1c67 100644 --- a/src/main/java/org/apache/datasketches/quantilescommon/DoublesSortedView.java +++ b/src/main/java/org/apache/datasketches/quantilescommon/DoublesSortedView.java @@ -60,7 +60,7 @@ public interface DoublesSortedView extends SortedView { * @return a discrete CDF array of m+1 double ranks (or cumulative probabilities) on the interval [0.0, 1.0]. * @throws IllegalArgumentException if sketch is empty. */ - default double[] getCDF(double[] splitPoints, QuantileSearchCriteria searchCrit) { + default double[] getCDF(final double[] splitPoints, final QuantileSearchCriteria searchCrit) { QuantilesUtil.checkDoublesSplitPointsOrder(splitPoints); final int len = splitPoints.length + 1; final double[] buckets = new double[len]; @@ -129,7 +129,7 @@ default double[] getCDF(double[] splitPoints, QuantileSearchCriteria searchCrit) * @return a PMF array of m+1 probability masses as doubles on the interval [0.0, 1.0]. * @throws IllegalArgumentException if sketch is empty. */ - default double[] getPMF(double[] splitPoints, QuantileSearchCriteria searchCrit) { + default double[] getPMF(final double[] splitPoints, final QuantileSearchCriteria searchCrit) { final double[] buckets = getCDF(splitPoints, searchCrit); final int len = buckets.length; for (int i = len; i-- > 1; ) { diff --git a/src/main/java/org/apache/datasketches/quantilescommon/FloatsSortedView.java b/src/main/java/org/apache/datasketches/quantilescommon/FloatsSortedView.java index eec699d94..0667a6748 100644 --- a/src/main/java/org/apache/datasketches/quantilescommon/FloatsSortedView.java +++ b/src/main/java/org/apache/datasketches/quantilescommon/FloatsSortedView.java @@ -60,7 +60,7 @@ public interface FloatsSortedView extends SortedView { * @return a discrete CDF array of m+1 double ranks (or cumulative probabilities) on the interval [0.0, 1.0]. * @throws IllegalArgumentException if sketch is empty. */ - default double[] getCDF(float[] splitPoints, QuantileSearchCriteria searchCrit) { + default double[] getCDF(final float[] splitPoints, final QuantileSearchCriteria searchCrit) { QuantilesUtil.checkFloatsSplitPointsOrder(splitPoints); final int len = splitPoints.length + 1; final double[] buckets = new double[len]; @@ -129,7 +129,7 @@ default double[] getCDF(float[] splitPoints, QuantileSearchCriteria searchCrit) * @return a PMF array of m+1 probability masses as doubles on the interval [0.0, 1.0]. * @throws IllegalArgumentException if sketch is empty. */ - default double[] getPMF(float[] splitPoints, QuantileSearchCriteria searchCrit) { + default double[] getPMF(final float[] splitPoints, final QuantileSearchCriteria searchCrit) { final double[] buckets = getCDF(splitPoints, searchCrit); final int len = buckets.length; for (int i = len; i-- > 1; ) { diff --git a/src/main/java/org/apache/datasketches/quantilescommon/LongsSortedView.java b/src/main/java/org/apache/datasketches/quantilescommon/LongsSortedView.java index e7e3521c7..eaeceeb92 100644 --- a/src/main/java/org/apache/datasketches/quantilescommon/LongsSortedView.java +++ b/src/main/java/org/apache/datasketches/quantilescommon/LongsSortedView.java @@ -60,7 +60,7 @@ public interface LongsSortedView extends SortedView { * @return a discrete CDF array of m+1 double ranks (or cumulative probabilities) on the interval [0.0, 1.0]. * @throws IllegalArgumentException if sketch is empty. */ - default double[] getCDF(long[] splitPoints, QuantileSearchCriteria searchCrit) { + default double[] getCDF(final long[] splitPoints, final QuantileSearchCriteria searchCrit) { QuantilesUtil.checkLongsSplitPointsOrder(splitPoints); final int len = splitPoints.length + 1; final double[] buckets = new double[len]; @@ -129,7 +129,7 @@ default double[] getCDF(long[] splitPoints, QuantileSearchCriteria searchCrit) { * @return a PMF array of m+1 probability masses as doubles on the interval [0.0, 1.0]. * @throws IllegalArgumentException if sketch is empty. */ - default double[] getPMF(long[] splitPoints, QuantileSearchCriteria searchCrit) { + default double[] getPMF(final long[] splitPoints, final QuantileSearchCriteria searchCrit) { final double[] buckets = getCDF(splitPoints, searchCrit); final int len = buckets.length; for (int i = len; i-- > 1; ) { diff --git a/src/main/java/org/apache/datasketches/quantilescommon/PartitioningFeature.java b/src/main/java/org/apache/datasketches/quantilescommon/PartitioningFeature.java index 5672c2a02..82b293b3a 100644 --- a/src/main/java/org/apache/datasketches/quantilescommon/PartitioningFeature.java +++ b/src/main/java/org/apache/datasketches/quantilescommon/PartitioningFeature.java @@ -53,7 +53,7 @@ public interface PartitioningFeature { * * @return an instance of {@link GenericPartitionBoundaries GenericPartitionBoundaries}. */ - default GenericPartitionBoundaries getPartitionBoundariesFromNumParts(int numEquallySizedParts) { + default GenericPartitionBoundaries getPartitionBoundariesFromNumParts(final int numEquallySizedParts) { return getPartitionBoundariesFromNumParts(numEquallySizedParts, INCLUSIVE); } @@ -106,7 +106,7 @@ GenericPartitionBoundaries getPartitionBoundariesFromNumParts( * * @return an instance of {@link GenericPartitionBoundaries GenericPartitionBoundaries}. */ - default GenericPartitionBoundaries getPartitionBoundariesFromPartSize(long nominalPartSizeItems) { + default GenericPartitionBoundaries getPartitionBoundariesFromPartSize(final long nominalPartSizeItems) { return getPartitionBoundariesFromPartSize(nominalPartSizeItems, INCLUSIVE); } diff --git a/src/main/java/org/apache/datasketches/quantilescommon/QuantilesDoublesAPI.java b/src/main/java/org/apache/datasketches/quantilescommon/QuantilesDoublesAPI.java index 8c4f6620f..09cfd6071 100644 --- a/src/main/java/org/apache/datasketches/quantilescommon/QuantilesDoublesAPI.java +++ b/src/main/java/org/apache/datasketches/quantilescommon/QuantilesDoublesAPI.java @@ -35,7 +35,7 @@ public interface QuantilesDoublesAPI extends QuantilesAPI { * @return a discrete CDF array of m+1 double ranks (or cumulative probabilities) on the interval [0.0, 1.0]. * @throws IllegalArgumentException if sketch is empty. */ - default double[] getCDF(double[] splitPoints) { + default double[] getCDF(final double[] splitPoints) { return getCDF(splitPoints, INCLUSIVE); } @@ -98,7 +98,7 @@ default double[] getCDF(double[] splitPoints) { * @return a PMF array of m+1 probability masses as doubles on the interval [0.0, 1.0]. * @throws IllegalArgumentException if sketch is empty. */ - default double[] getPMF(double[] splitPoints) { + default double[] getPMF(final double[] splitPoints) { return getPMF(splitPoints, INCLUSIVE); } @@ -150,7 +150,7 @@ default double[] getPMF(double[] splitPoints) { * @return the approximate quantile given the normalized rank. * @throws IllegalArgumentException if sketch is empty. */ - default double getQuantile(double rank) { + default double getQuantile(final double rank) { return getQuantile(rank, INCLUSIVE); } @@ -207,7 +207,7 @@ default double getQuantile(double rank) { * @return an array of quantiles corresponding to the given array of normalized ranks. * @throws IllegalArgumentException if sketch is empty. */ - default double[] getQuantiles(double[] ranks) { + default double[] getQuantiles(final double[] ranks) { return getQuantiles(ranks, INCLUSIVE); } @@ -230,7 +230,7 @@ default double[] getQuantiles(double[] ranks) { * @return the normalized rank corresponding to the given quantile * @throws IllegalArgumentException if sketch is empty. */ - default double getRank(double quantile) { + default double getRank(final double quantile) { return getRank(quantile, INCLUSIVE); } @@ -251,7 +251,7 @@ default double getRank(double quantile) { * @return an array of normalized ranks corresponding to the given array of quantiles. * @throws IllegalArgumentException if sketch is empty. */ - default double[] getRanks(double[] quantiles) { + default double[] getRanks(final double[] quantiles) { return getRanks(quantiles, INCLUSIVE); } diff --git a/src/main/java/org/apache/datasketches/quantilescommon/QuantilesFloatsAPI.java b/src/main/java/org/apache/datasketches/quantilescommon/QuantilesFloatsAPI.java index 8b8a91bdd..2713e1b02 100644 --- a/src/main/java/org/apache/datasketches/quantilescommon/QuantilesFloatsAPI.java +++ b/src/main/java/org/apache/datasketches/quantilescommon/QuantilesFloatsAPI.java @@ -34,7 +34,7 @@ public interface QuantilesFloatsAPI extends QuantilesAPI { * @return a discrete CDF array of m+1 double ranks (or cumulative probabilities) on the interval [0.0, 1.0]. * @throws IllegalArgumentException if sketch is empty. */ - default double[] getCDF(float[] splitPoints) { + default double[] getCDF(final float[] splitPoints) { return getCDF(splitPoints, INCLUSIVE); } @@ -97,7 +97,7 @@ default double[] getCDF(float[] splitPoints) { * @return a PMF array of m+1 probability masses as doubles on the interval [0.0, 1.0]. * @throws IllegalArgumentException if sketch is empty. */ - default double[] getPMF(float[] splitPoints) { + default double[] getPMF(final float[] splitPoints) { return getPMF(splitPoints, INCLUSIVE); } @@ -149,7 +149,7 @@ default double[] getPMF(float[] splitPoints) { * @return the approximate quantile given the normalized rank. * @throws IllegalArgumentException if sketch is empty. */ - default float getQuantile(double rank) { + default float getQuantile(final double rank) { return getQuantile(rank, INCLUSIVE); } @@ -206,7 +206,7 @@ default float getQuantile(double rank) { * @return an array of quantiles corresponding to the given array of normalized ranks. * @throws IllegalArgumentException if sketch is empty. */ - default float[] getQuantiles(double[] ranks) { + default float[] getQuantiles(final double[] ranks) { return getQuantiles(ranks, INCLUSIVE); } @@ -229,7 +229,7 @@ default float[] getQuantiles(double[] ranks) { * @return the normalized rank corresponding to the given quantile. * @throws IllegalArgumentException if sketch is empty. */ - default double getRank(float quantile) { + default double getRank(final float quantile) { return getRank(quantile, INCLUSIVE); } @@ -250,7 +250,7 @@ default double getRank(float quantile) { * @return an array of normalized ranks corresponding to the given array of quantiles. * @throws IllegalArgumentException if sketch is empty. */ - default double[] getRanks(float[] quantiles) { + default double[] getRanks(final float[] quantiles) { return getRanks(quantiles, INCLUSIVE); } diff --git a/src/main/java/org/apache/datasketches/quantilescommon/QuantilesGenericAPI.java b/src/main/java/org/apache/datasketches/quantilescommon/QuantilesGenericAPI.java index c6a05ffa1..d1592e244 100644 --- a/src/main/java/org/apache/datasketches/quantilescommon/QuantilesGenericAPI.java +++ b/src/main/java/org/apache/datasketches/quantilescommon/QuantilesGenericAPI.java @@ -38,7 +38,7 @@ public interface QuantilesGenericAPI extends QuantilesAPI, PartitioningFeatur * @return a discrete CDF array of m+1 double ranks (or cumulative probabilities) on the interval [0.0, 1.0]. * @throws IllegalArgumentException if sketch is empty. */ - default double[] getCDF(T[] splitPoints) { + default double[] getCDF(final T[] splitPoints) { return getCDF(splitPoints, INCLUSIVE); } @@ -118,7 +118,7 @@ default int getMaxPartitions() { * @return a PMF array of m+1 probability masses as doubles on the interval [0.0, 1.0]. * @throws IllegalArgumentException if sketch is empty. */ - default double[] getPMF(T[] splitPoints) { + default double[] getPMF(final T[] splitPoints) { return getPMF(splitPoints, INCLUSIVE); } @@ -170,7 +170,7 @@ default double[] getPMF(T[] splitPoints) { * @return the approximate quantile given the normalized rank. * @throws IllegalArgumentException if sketch is empty. */ - default T getQuantile(double rank) { + default T getQuantile(final double rank) { return getQuantile(rank, INCLUSIVE); } @@ -227,7 +227,7 @@ default T getQuantile(double rank) { * @return an array of quantiles corresponding to the given array of normalized ranks. * @throws IllegalArgumentException if sketch is empty. */ - default T[] getQuantiles(double[] ranks) { + default T[] getQuantiles(final double[] ranks) { return getQuantiles(ranks, INCLUSIVE); } @@ -250,7 +250,7 @@ default T[] getQuantiles(double[] ranks) { * @return the normalized rank corresponding to the given quantile. * @throws IllegalArgumentException if sketch is empty. */ - default double getRank(T quantile) { + default double getRank(final T quantile) { return getRank(quantile, INCLUSIVE); } @@ -271,7 +271,7 @@ default double getRank(T quantile) { * @return an array of normalized ranks corresponding to the given array of quantiles. * @throws IllegalArgumentException if sketch is empty. */ - default double[] getRanks(T[] quantiles) { + default double[] getRanks(final T[] quantiles) { return getRanks(quantiles, INCLUSIVE); } diff --git a/src/main/java/org/apache/datasketches/quantilescommon/QuantilesLongsAPI.java b/src/main/java/org/apache/datasketches/quantilescommon/QuantilesLongsAPI.java index fb1ca5817..51802df71 100644 --- a/src/main/java/org/apache/datasketches/quantilescommon/QuantilesLongsAPI.java +++ b/src/main/java/org/apache/datasketches/quantilescommon/QuantilesLongsAPI.java @@ -35,7 +35,7 @@ public interface QuantilesLongsAPI extends QuantilesAPI { * @return a discrete CDF array of m+1 double ranks (or cumulative probabilities) on the interval [0.0, 1.0]. * @throws IllegalArgumentException if sketch is empty. */ - default double[] getCDF(long[] splitPoints) { + default double[] getCDF(final long[] splitPoints) { return getCDF(splitPoints, INCLUSIVE); } @@ -98,7 +98,7 @@ default double[] getCDF(long[] splitPoints) { * @return a PMF array of m+1 probability masses as doubles on the interval [0.0, 1.0]. * @throws IllegalArgumentException if sketch is empty. */ - default double[] getPMF(long[] splitPoints) { + default double[] getPMF(final long[] splitPoints) { return getPMF(splitPoints, INCLUSIVE); } @@ -150,7 +150,7 @@ default double[] getPMF(long[] splitPoints) { * @return the approximate quantile given the normalized rank. * @throws IllegalArgumentException if sketch is empty. */ - default long getQuantile(double rank) { + default long getQuantile(final double rank) { return getQuantile(rank, INCLUSIVE); } @@ -207,7 +207,7 @@ default long getQuantile(double rank) { * @return an array of quantiles corresponding to the given array of normalized ranks. * @throws IllegalArgumentException if sketch is empty. */ - default long[] getQuantiles(double[] ranks) { + default long[] getQuantiles(final double[] ranks) { return getQuantiles(ranks, INCLUSIVE); } @@ -230,7 +230,7 @@ default long[] getQuantiles(double[] ranks) { * @return the normalized rank corresponding to the given quantile * @throws IllegalArgumentException if sketch is empty. */ - default double getRank(long quantile) { + default double getRank(final long quantile) { return getRank(quantile, INCLUSIVE); } @@ -251,7 +251,7 @@ default double getRank(long quantile) { * @return an array of normalized ranks corresponding to the given array of quantiles. * @throws IllegalArgumentException if sketch is empty. */ - default double[] getRanks(long[] quantiles) { + default double[] getRanks(final long[] quantiles) { return getRanks(quantiles, INCLUSIVE); } diff --git a/src/main/java/org/apache/datasketches/theta/ConcurrentSharedThetaSketch.java b/src/main/java/org/apache/datasketches/theta/ConcurrentSharedThetaSketch.java index cdc843f8b..1bbdcc12a 100644 --- a/src/main/java/org/apache/datasketches/theta/ConcurrentSharedThetaSketch.java +++ b/src/main/java/org/apache/datasketches/theta/ConcurrentSharedThetaSketch.java @@ -36,7 +36,7 @@ interface ConcurrentSharedThetaSketch extends MemoryStatus { long NOT_SINGLE_HASH = -1L; double MIN_ERROR = 0.0000001; - static long computeExactLimit(long k, double error) { + static long computeExactLimit(final long k, final double error) { return 2 * Math.min(k, (long) Math.ceil(1.0 / Math.pow(Math.max(error,MIN_ERROR), 2.0))); } From b9a626194d19effefbf00ea9aedbc6698050ef4e Mon Sep 17 00:00:00 2001 From: Lee Rhodes Date: Wed, 7 May 2025 15:52:41 -0700 Subject: [PATCH 2/2] revert to jdk21 for the time being. --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index a9858526a..5ea3a7ac4 100644 --- a/pom.xml +++ b/pom.xml @@ -94,8 +94,8 @@ under the License. 3.6.3 - 22 - + 21 + --enable-preview ${java.version} ${java.version} -Xmx4g -Duser.language=en -Duser.country=US -Dfile.encoding=UTF-8 ${jvm-arguments} @@ -190,7 +190,7 @@ under the License. - [22,) + [21,) [${maven.version},4.0.0)