You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ah...@apache.org on 2024/07/09 13:46:11 UTC

(commons-numbers) branch master updated (cc0d4d02 -> 20e57acd)

This is an automated email from the ASF dual-hosted git repository.

aherbert pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-numbers.git


    from cc0d4d02 Update profile name in referencing documents
     new ffd322b5 Javadoc protected/public constructors and methods
     new 20e57acd Add JDK 21 to GH maven workflow

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .github/workflows/maven.yml                            |  2 +-
 .../java/org/apache/commons/numbers/angle/Angle.java   | 18 ++++++++++++++++++
 .../java/org/apache/commons/numbers/angle/Reduce.java  |  2 ++
 .../commons/numbers/combinatorics/Combinations.java    |  2 ++
 .../apache/commons/numbers/field/AbstractField.java    |  3 +++
 .../apache/commons/numbers/field/BigFractionField.java |  6 +++++-
 .../java/org/apache/commons/numbers/field/DDField.java |  6 +++++-
 .../org/apache/commons/numbers/field/FP64Field.java    |  6 +++++-
 .../java/org/apache/commons/numbers/field/Field.java   | 18 ++++++++++++++++++
 .../apache/commons/numbers/field/FractionField.java    |  6 +++++-
 .../commons/numbers/fraction/ContinuedFraction.java    |  3 +++
 .../commons/numbers/gamma/LanczosApproximation.java    |  4 +++-
 src/conf/pmd/pmd-ruleset.xml                           |  4 ++++
 13 files changed, 74 insertions(+), 6 deletions(-)


(commons-numbers) 02/02: Add JDK 21 to GH maven workflow

Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-numbers.git

commit 20e57acd54d29a3d3c881aa5f71a80e06a5b1cfe
Author: Alex Herbert <ah...@apache.org>
AuthorDate: Tue Jul 9 14:46:01 2024 +0100

    Add JDK 21 to GH maven workflow
---
 .github/workflows/maven.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 661e1e87..6ad515f8 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -26,7 +26,7 @@ jobs:
     runs-on: ubuntu-latest
     strategy:
       matrix:
-        java: [ 8, 11, 17 ]
+        java: [ 8, 11, 17, 21 ]
 
     steps:
     - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 4.1.1


(commons-numbers) 01/02: Javadoc protected/public constructors and methods

Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-numbers.git

commit ffd322b5761b4d5676ea5d64235fcf7974b785bc
Author: Alex Herbert <ah...@apache.org>
AuthorDate: Tue Jul 9 14:44:37 2024 +0100

    Javadoc protected/public constructors and methods
    
    Added to avoid warnings when building on Java 21 (which fail the build).
    
    This requires adding implicit public constructors.
---
 .../java/org/apache/commons/numbers/angle/Angle.java   | 18 ++++++++++++++++++
 .../java/org/apache/commons/numbers/angle/Reduce.java  |  2 ++
 .../commons/numbers/combinatorics/Combinations.java    |  2 ++
 .../apache/commons/numbers/field/AbstractField.java    |  3 +++
 .../apache/commons/numbers/field/BigFractionField.java |  6 +++++-
 .../java/org/apache/commons/numbers/field/DDField.java |  6 +++++-
 .../org/apache/commons/numbers/field/FP64Field.java    |  6 +++++-
 .../java/org/apache/commons/numbers/field/Field.java   | 18 ++++++++++++++++++
 .../apache/commons/numbers/field/FractionField.java    |  6 +++++-
 .../commons/numbers/fraction/ContinuedFraction.java    |  3 +++
 .../commons/numbers/gamma/LanczosApproximation.java    |  4 +++-
 src/conf/pmd/pmd-ruleset.xml                           |  4 ++++
 12 files changed, 73 insertions(+), 5 deletions(-)

diff --git a/commons-numbers-angle/src/main/java/org/apache/commons/numbers/angle/Angle.java b/commons-numbers-angle/src/main/java/org/apache/commons/numbers/angle/Angle.java
index d38c3c8d..2f50e816 100644
--- a/commons-numbers-angle/src/main/java/org/apache/commons/numbers/angle/Angle.java
+++ b/commons-numbers-angle/src/main/java/org/apache/commons/numbers/angle/Angle.java
@@ -74,16 +74,22 @@ public abstract class Angle implements DoubleSupplier {
     }
 
     /**
+     * Convert to a {@link Turn}.
+     *
      * @return the angle in <a href="https://en.wikipedia.org/wiki/Turn_%28geometry%29">turns</a>.
      */
     public abstract Turn toTurn();
 
     /**
+     * Convert to a {@link Rad}.
+     *
      * @return the angle in <a href="https://en.wikipedia.org/wiki/Radian">radians</a>.
      */
     public abstract Rad toRad();
 
     /**
+     * Convert to a {@link Deg}.
+     *
      * @return the angle in <a href="https://en.wikipedia.org/wiki/Degree_%28angle%29">degrees</a>.
      */
     public abstract Deg toDeg();
@@ -98,6 +104,8 @@ public abstract class Angle implements DoubleSupplier {
         public static final DoubleUnaryOperator WITHIN_0_AND_1 = normalizer(0d);
 
         /**
+         * Create an instance.
+         *
          * @param angle (in turns).
          */
         private Turn(final double angle) {
@@ -105,6 +113,8 @@ public abstract class Angle implements DoubleSupplier {
         }
 
         /**
+         * Create an instance.
+         *
          * @param angle (in turns).
          * @return a new instance.
          */
@@ -158,6 +168,8 @@ public abstract class Angle implements DoubleSupplier {
         public static final DoubleUnaryOperator WITHIN_MINUS_PI_AND_PI = normalizer(-Math.PI);
 
         /**
+         * Create an instance.
+         *
          * @param angle (in radians).
          */
         private Rad(final double angle) {
@@ -165,6 +177,8 @@ public abstract class Angle implements DoubleSupplier {
         }
 
         /**
+         * Create an instance.
+         *
          * @param angle (in radians).
          * @return a new instance.
          */
@@ -212,6 +226,8 @@ public abstract class Angle implements DoubleSupplier {
         public static final DoubleUnaryOperator WITHIN_0_AND_360 = normalizer(0d);
 
         /**
+         * Create an instance.
+         *
          * @param angle (in degrees).
          */
         private Deg(final double angle) {
@@ -219,6 +235,8 @@ public abstract class Angle implements DoubleSupplier {
         }
 
         /**
+         * Create an instance.
+         *
          * @param angle (in degrees).
          * @return a new instance.
          */
diff --git a/commons-numbers-angle/src/main/java/org/apache/commons/numbers/angle/Reduce.java b/commons-numbers-angle/src/main/java/org/apache/commons/numbers/angle/Reduce.java
index 7123c2d6..751378c5 100644
--- a/commons-numbers-angle/src/main/java/org/apache/commons/numbers/angle/Reduce.java
+++ b/commons-numbers-angle/src/main/java/org/apache/commons/numbers/angle/Reduce.java
@@ -31,6 +31,8 @@ public class Reduce implements DoubleUnaryOperator {
     private final double period;
 
     /**
+     * Create an instance.
+     *
      * @param offset Value that will be mapped to {@code 0}.
      * @param period Period.
      */
diff --git a/commons-numbers-combinatorics/src/main/java/org/apache/commons/numbers/combinatorics/Combinations.java b/commons-numbers-combinatorics/src/main/java/org/apache/commons/numbers/combinatorics/Combinations.java
index 959d2df4..8e5edbfa 100644
--- a/commons-numbers-combinatorics/src/main/java/org/apache/commons/numbers/combinatorics/Combinations.java
+++ b/commons-numbers-combinatorics/src/main/java/org/apache/commons/numbers/combinatorics/Combinations.java
@@ -50,6 +50,8 @@ public final class Combinations implements Iterable<int[]> {
     }
 
     /**
+     * Create an instance.
+     *
      * @param n Size of the set from which subsets are selected.
      * @param k Size of the subsets to be enumerated.
      * @throws IllegalArgumentException if {@code n < 0}.
diff --git a/commons-numbers-field/src/main/java/org/apache/commons/numbers/field/AbstractField.java b/commons-numbers-field/src/main/java/org/apache/commons/numbers/field/AbstractField.java
index b5a4ad07..c82e590e 100644
--- a/commons-numbers-field/src/main/java/org/apache/commons/numbers/field/AbstractField.java
+++ b/commons-numbers-field/src/main/java/org/apache/commons/numbers/field/AbstractField.java
@@ -25,6 +25,9 @@ import org.apache.commons.numbers.core.NativeOperators;
  */
 public abstract class AbstractField<T extends NativeOperators<T>>
     implements Field<T> {
+    /** Create an instance. */
+    public AbstractField() {}
+
     /** {@inheritDoc} */
     @Override
     public T add(T a, T b) {
diff --git a/commons-numbers-field/src/main/java/org/apache/commons/numbers/field/BigFractionField.java b/commons-numbers-field/src/main/java/org/apache/commons/numbers/field/BigFractionField.java
index e46dc439..107df10c 100644
--- a/commons-numbers-field/src/main/java/org/apache/commons/numbers/field/BigFractionField.java
+++ b/commons-numbers-field/src/main/java/org/apache/commons/numbers/field/BigFractionField.java
@@ -28,7 +28,11 @@ public final class BigFractionField extends AbstractField<BigFraction> {
     /** Singleton. */
     private BigFractionField() {}
 
-    /** @return the field instance. */
+    /**
+     * Get the field instance.
+     *
+     * @return the field instance.
+     */
     public static BigFractionField get() {
         return INSTANCE;
     }
diff --git a/commons-numbers-field/src/main/java/org/apache/commons/numbers/field/DDField.java b/commons-numbers-field/src/main/java/org/apache/commons/numbers/field/DDField.java
index c36521c3..4a6a7550 100644
--- a/commons-numbers-field/src/main/java/org/apache/commons/numbers/field/DDField.java
+++ b/commons-numbers-field/src/main/java/org/apache/commons/numbers/field/DDField.java
@@ -28,7 +28,11 @@ public final class DDField extends AbstractField<DD> {
     /** Singleton. */
     private DDField() {}
 
-    /** @return the field instance. */
+    /**
+     * Get the field instance.
+     *
+     * @return the field instance.
+     */
     public static DDField get() {
         return INSTANCE;
     }
diff --git a/commons-numbers-field/src/main/java/org/apache/commons/numbers/field/FP64Field.java b/commons-numbers-field/src/main/java/org/apache/commons/numbers/field/FP64Field.java
index c853dbd2..e32c37d1 100644
--- a/commons-numbers-field/src/main/java/org/apache/commons/numbers/field/FP64Field.java
+++ b/commons-numbers-field/src/main/java/org/apache/commons/numbers/field/FP64Field.java
@@ -30,7 +30,11 @@ public final class FP64Field extends AbstractField<FP64> {
     /** Singleton. */
     private FP64Field() {}
 
-    /** @return the field instance. */
+    /**
+     * Get the field instance.
+     *
+     * @return the field instance.
+     */
     public static FP64Field get() {
         return INSTANCE;
     }
diff --git a/commons-numbers-field/src/main/java/org/apache/commons/numbers/field/Field.java b/commons-numbers-field/src/main/java/org/apache/commons/numbers/field/Field.java
index 6ddf0858..2d99acd5 100644
--- a/commons-numbers-field/src/main/java/org/apache/commons/numbers/field/Field.java
+++ b/commons-numbers-field/src/main/java/org/apache/commons/numbers/field/Field.java
@@ -23,6 +23,8 @@ package org.apache.commons.numbers.field;
  */
 public interface Field<T> {
     /**
+     * Add the elements.
+     *
      * @param a Field element.
      * @param b Field element.
      * @return {@code a + b}.
@@ -30,6 +32,8 @@ public interface Field<T> {
     T add(T a, T b);
 
     /**
+     * Subtract the element {@code b} from {@code a}.
+     *
      * @param a Field element.
      * @param b Field element.
      * @return {@code a - b}.
@@ -37,12 +41,16 @@ public interface Field<T> {
     T subtract(T a, T b);
 
     /**
+     * Negate the element.
+     *
      * @param a Field element.
      * @return {@code -a}.
      */
     T negate(T a);
 
     /**
+     * Multiply the element {@code a} a number of times {@code n}.
+     *
      * @param a Field element.
      * @param n Number of times {@code a} must be added to itself.
      * @return {@code n a}.
@@ -50,6 +58,8 @@ public interface Field<T> {
     T multiply(int n, T a);
 
     /**
+     * Multiply the elements.
+     *
      * @param a Field element.
      * @param b Field element.
      * @return {@code a * b}.
@@ -57,6 +67,8 @@ public interface Field<T> {
     T multiply(T a, T b);
 
     /**
+     * Divide the element {@code a} by {@code b}.
+     *
      * @param a Field element.
      * @param b Field element.
      * @return <code>a * b<sup>-1</sup></code>.
@@ -64,18 +76,24 @@ public interface Field<T> {
     T divide(T a, T b);
 
     /**
+     * Return the reciprocal (multiplicative inverse).
+     *
      * @param a Field element.
      * @return <code>a<sup>-1</sup></code>.
      */
     T reciprocal(T a);
 
     /**
+     * Return the value of one.
+     *
      * @return the field element {@code 1} such that for all {@code a},
      * {@code 1 * a == a}.
      */
     T one();
 
     /**
+     * Return the value of zero.
+     *
      * @return the field element {@code 0} such that for all {@code a},
      * {@code 0 + a == a}.
      */
diff --git a/commons-numbers-field/src/main/java/org/apache/commons/numbers/field/FractionField.java b/commons-numbers-field/src/main/java/org/apache/commons/numbers/field/FractionField.java
index ba5549ca..4e0f2149 100644
--- a/commons-numbers-field/src/main/java/org/apache/commons/numbers/field/FractionField.java
+++ b/commons-numbers-field/src/main/java/org/apache/commons/numbers/field/FractionField.java
@@ -28,7 +28,11 @@ public final class FractionField extends AbstractField<Fraction> {
     /** Singleton. */
     private FractionField() {}
 
-    /** @return the field instance. */
+    /**
+     * Get the field instance.
+     *
+     * @return the field instance.
+     */
     public static FractionField get() {
         return INSTANCE;
     }
diff --git a/commons-numbers-fraction/src/main/java/org/apache/commons/numbers/fraction/ContinuedFraction.java b/commons-numbers-fraction/src/main/java/org/apache/commons/numbers/fraction/ContinuedFraction.java
index d56a381b..ed8323c1 100644
--- a/commons-numbers-fraction/src/main/java/org/apache/commons/numbers/fraction/ContinuedFraction.java
+++ b/commons-numbers-fraction/src/main/java/org/apache/commons/numbers/fraction/ContinuedFraction.java
@@ -45,6 +45,9 @@ import org.apache.commons.numbers.fraction.GeneralizedContinuedFraction.Coeffici
  * with updates to the previous coefficients.
  */
 public abstract class ContinuedFraction {
+    /** Create an instance. */
+    public ContinuedFraction() {}
+
     /**
      * Defines the <a href="https://mathworld.wolfram.com/ContinuedFraction.html">
      * {@code n}-th "a" coefficient</a> of the continued fraction.
diff --git a/commons-numbers-gamma/src/main/java/org/apache/commons/numbers/gamma/LanczosApproximation.java b/commons-numbers-gamma/src/main/java/org/apache/commons/numbers/gamma/LanczosApproximation.java
index 53a88ac8..1b809e78 100644
--- a/commons-numbers-gamma/src/main/java/org/apache/commons/numbers/gamma/LanczosApproximation.java
+++ b/commons-numbers-gamma/src/main/java/org/apache/commons/numbers/gamma/LanczosApproximation.java
@@ -73,7 +73,9 @@ public final class LanczosApproximation {
     }
 
     /**
-     * @return the Lanczos constant \( g = \frac{607}{128} \).
+     * Return the Lanczos constant \( g = \frac{607}{128} \).
+     *
+     * @return the Lanczos constant.
      */
     public static double g() {
         return LANCZOS_G;
diff --git a/src/conf/pmd/pmd-ruleset.xml b/src/conf/pmd/pmd-ruleset.xml
index a72b73d2..c71309f4 100644
--- a/src/conf/pmd/pmd-ruleset.xml
+++ b/src/conf/pmd/pmd-ruleset.xml
@@ -40,6 +40,8 @@
     <exclude name="OnlyOneReturn" />
     <exclude name="UseUnderscoresInNumericLiterals" />
     <exclude name="ShortClassName" />
+    <!-- Constructors are added to avoid javadoc warnings on JDK 21 -->
+    <exclude name="UnnecessaryConstructor" />
   </rule>
   <rule ref="category/java/design.xml">
     <exclude name="TooManyMethods" />
@@ -48,6 +50,8 @@
   </rule>
   <rule ref="category/java/documentation.xml">
     <exclude name="CommentSize" />
+    <!-- Constructors are added to avoid javadoc warnings on JDK 21 -->
+    <exclude name="UncommentedEmptyConstructor" />
   </rule>
   <rule ref="category/java/errorprone.xml">
     <!-- <exclude name="..." /> -->