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

desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git

commit 49cb980e1a4048f0544db2c23c4594f0a8ab34a7
Author: Martin Desruisseaux <[email protected]>
AuthorDate: Fri Oct 10 14:12:55 2025 +0200

    Adjustments in the unit of measurement implementation for alignment with 
Seshat 1.5.
---
 .../org/apache/sis/measure/AbstractConverter.java  | 18 ++++++++---
 .../apache/sis/measure/ConcatenatedConverter.java  |  3 ++
 .../org/apache/sis/measure/IdentityConverter.java  |  2 +-
 .../org/apache/sis/measure/LinearConverter.java    |  3 ++
 .../org/apache/sis/measure/ScaleRateOfChange.java  |  5 ++--
 .../main/org/apache/sis/measure/UnitDimension.java |  9 +++---
 .../main/org/apache/sis/measure/UnitFormat.java    | 35 +++++++++++-----------
 .../main/org/apache/sis/measure/UnitRegistry.java  |  8 ++---
 .../main/org/apache/sis/measure/UnitServices.java  |  4 +--
 .../main/org/apache/sis/measure/Units.java         |  3 +-
 .../apache/sis/system/ReferenceQueueConsumer.java  |  2 +-
 .../main/org/apache/sis/util/StringBuilders.java   |  4 +--
 .../sis/util/collection/WeakValueHashMap.java      |  6 ++--
 .../sis/util/internal/shared/DefinitionURI.java    | 14 ++++-----
 .../sis/util/resources/IndexedResourceBundle.java  |  4 +--
 .../apache/sis/measure/ConventionalUnitTest.java   |  1 +
 .../apache/sis/measure/LinearConverterTest.java    |  2 ++
 .../test/org/apache/sis/measure/PrefixesTest.java  |  1 +
 .../org/apache/sis/measure/QuantitiesTest.java     |  1 +
 .../test/org/apache/sis/measure/ScalarTest.java    |  1 +
 .../sis/measure/SexagesimalConverterTest.java      |  1 +
 .../org/apache/sis/measure/SystemUnitTest.java     |  1 +
 .../org/apache/sis/measure/UnitDimensionTest.java  |  1 +
 .../org/apache/sis/measure/UnitFormatTest.java     |  1 +
 .../org/apache/sis/measure/UnitServicesTest.java   |  1 +
 .../test/org/apache/sis/measure/UnitsTest.java     |  1 +
 .../sis/util/collection/WeakHashSetTest.java       | 13 ++++----
 .../sis/util/collection/WeakValueHashMapTest.java  | 13 ++++----
 .../util/internal/shared/DefinitionURITest.java    |  4 +--
 29 files changed, 97 insertions(+), 65 deletions(-)

diff --git 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/AbstractConverter.java
 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/AbstractConverter.java
index ec0761e16d..6388d5ed23 100644
--- 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/AbstractConverter.java
+++ 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/AbstractConverter.java
@@ -57,6 +57,8 @@ public abstract class AbstractConverter implements 
UnitConverter, Serializable {
      * Returns {@code true} if {@link #convert(double)} returns given values 
unchanged.
      * The default implementation returns {@code false} for convenience of 
non-linear conversions.
      * Subclasses should override if their conversions may be identity.
+     *
+     * @return whether this converter performs no operation.
      */
     @Override
     public boolean isIdentity() {
@@ -65,12 +67,16 @@ public abstract class AbstractConverter implements 
UnitConverter, Serializable {
 
     /**
      * Indicates if this converter is linear in JSR-385 sense (not the usual 
mathematical sense).
-     * The default implementation returns {@code false} for convenience of 
non-linear conversions.
-     * Subclasses should override if their conversions may be identity.
+     * This is {@code true} if this converter contains a scale <em>but no 
offset</em>.
+     *
+     * @return whether this converter contains an offset.
+     *
+     * @deprecated This method is badly named, but we can't change since it is 
defined by JSR-385.
      */
     @Override
+    @Deprecated
     public boolean isLinear() {
-        return false;
+        return isIdentity();
     }
 
     /**
@@ -85,6 +91,9 @@ public abstract class AbstractConverter implements 
UnitConverter, Serializable {
      * Performs a unit conversion on the given number. The default 
implementation delegates to the version working
      * on {@code double} primitive type, so it may not provide the accuracy 
normally required by this method contract.
      * Linear conversions should override this method.
+     *
+     * @param  value  the value to convert.
+     * @return the converted value.
      */
     @Override
     public Number convert(final Number value) {
@@ -93,9 +102,10 @@ public abstract class AbstractConverter implements 
UnitConverter, Serializable {
 
     /**
      * Returns the derivative of the conversion function at the given value, 
or {@code NaN} if unknown.
+     * The given argument is ignored (can be {@link Double#NaN}) if the 
conversion is linear.
      *
      * @param  value  the point at which to compute the derivative.
-     *                Ignored (can be {@link Double#NaN}) if the conversion is 
linear.
+     * @return the derivative at the value.
      */
     public abstract double derivative(double value);
 
diff --git 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/ConcatenatedConverter.java
 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/ConcatenatedConverter.java
index 8970c57786..da96d580ea 100644
--- 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/ConcatenatedConverter.java
+++ 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/ConcatenatedConverter.java
@@ -74,8 +74,11 @@ final class ConcatenatedConverter extends AbstractConverter 
implements LenientCo
     /**
      * Returns {@code true} if the two unit converters are linear converters.
      * Should always be {@code false}, otherwise we would not have created a 
{@code ConcatenatedConverter}.
+     *
+     * @deprecated This method is badly named, but we can't change since it is 
defined by JSR-385.
      */
     @Override
+    @Deprecated
     public boolean isLinear() {
         return c1.isLinear() && c2.isLinear();
     }
diff --git 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/IdentityConverter.java
 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/IdentityConverter.java
index 7daffa9ac1..4809fdae0f 100644
--- 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/IdentityConverter.java
+++ 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/IdentityConverter.java
@@ -52,7 +52,7 @@ final class IdentityConverter extends AbstractConverter 
implements LenientCompar
     private IdentityConverter() {
     }
 
-    /** Straight forward implementation. */
+    @Deprecated
     @Override public boolean       isLinear()                   {return true;}
     @Override public boolean       isIdentity()                 {return true;}
     @Override public UnitConverter inverse()                    {return this;}
diff --git 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/LinearConverter.java
 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/LinearConverter.java
index 07067471d9..dd8fd055d4 100644
--- 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/LinearConverter.java
+++ 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/LinearConverter.java
@@ -194,8 +194,11 @@ final class LinearConverter extends AbstractConverter 
implements LenientComparab
      *
      * Note that this definition allows scale factors but does not allow 
offsets.
      * Consequently, this is a different definition of "linear" than this 
class and the rest of Apache SIS.
+     *
+     * @deprecated This method is badly named, but we can't change since it is 
defined by JSR-385.
      */
     @Override
+    @Deprecated
     public boolean isLinear() {
         return offset == 0;
     }
diff --git 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/ScaleRateOfChange.java
 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/ScaleRateOfChange.java
index 82b7d7758e..ed23f2cf0a 100644
--- 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/ScaleRateOfChange.java
+++ 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/ScaleRateOfChange.java
@@ -20,8 +20,9 @@ import javax.measure.Quantity;
 
 
 /**
- * The rate of change of a scale factor, in unity per second. This unit is 
specific to the EPSG database.
- * It has the same units as frequency, but it still not the same thing.
+ * The rate of change of a scale factor, in unity per second.
+ * It has the same units as frequency, but not the same interpretation.
+ * This unit is used by the <abbr>EPSG</abbr> geodetic dataset.
  *
  * @author  Martin Desruisseaux (Geomatys)
  */
diff --git 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/UnitDimension.java
 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/UnitDimension.java
index f2d53cd57e..16f8f00bdf 100644
--- 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/UnitDimension.java
+++ 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/UnitDimension.java
@@ -34,7 +34,7 @@ import org.apache.sis.util.internal.shared.CollectionsExt;
 
 /**
  * Dimension (length, mass, time, <i>etc.</i>) of a unit of measurement.
- * Only two kind of dimensions are defined in Apache SIS:
+ * Only two kinds of dimensions are defined in Apache SIS:
  *
  * <ul>
  *   <li>Base dimensions are the 7 base dimensions specified by the SI 
system.</li>
@@ -90,6 +90,7 @@ final class UnitDimension implements Dimension, Serializable {
      *
      * @param  symbol  the symbol of this base dimension (not to be confused 
with unit symbol).
      */
+    @SuppressWarnings("ThisEscapedInObjectConstruction")    // Safe because 
this class is final.
     UnitDimension(final char symbol) {
         this.symbol = symbol;
         components  = Map.of(this, new Fraction(1,1).unique());
@@ -137,7 +138,7 @@ final class UnitDimension implements Dimension, 
Serializable {
             if (!Units.initialized) {
                 UnitRegistry.init(components, dim);
             } else {
-                final UnitDimension c = (UnitDimension) 
UnitRegistry.putIfAbsent(components, dim);
+                final var c = (UnitDimension) 
UnitRegistry.putIfAbsent(components, dim);
                 if (c != null) {
                     return c;       // UnitDimension created concurrently in 
another thread.
                 }
@@ -154,7 +155,7 @@ final class UnitDimension implements Dimension, 
Serializable {
             return NONE;
         }
         if (Units.initialized) {        // Force Units class initialization.
-            final UnitDimension dim = (UnitDimension) 
UnitRegistry.putIfAbsent(components, this);
+            final var dim = (UnitDimension) 
UnitRegistry.putIfAbsent(components, this);
             if (dim != null) {
                 return dim;
             }
@@ -432,7 +433,7 @@ final class UnitDimension implements Dimension, 
Serializable {
      */
     @Override
     public String toString() {
-        final StringBuilder buffer = new StringBuilder(8);
+        final var buffer = new StringBuilder(8);
         try {
             UnitFormat.formatComponents(components, UnitFormat.Style.SYMBOL, 
buffer);
         } catch (IOException e) {
diff --git 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/UnitFormat.java 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/UnitFormat.java
index 913bdba05e..4c1afa7b47 100644
--- 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/UnitFormat.java
+++ 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/UnitFormat.java
@@ -91,8 +91,7 @@ public class UnitFormat extends Format implements 
javax.measure.format.UnitForma
     /**
      * The authorities to accept, or {@code null} for disabling authority 
parsing.
      * Codes may be URLs such as {@code 
"http://www.opengis.net/def/uom/UCUM/0/d"}
-     * or URNs such as {@code "EPSG:9001"}. The order of authority names 
matter,
-     * because the index is used for identifying the authority.
+     * or URNs such as {@code "EPSG:9001"}.
      */
     @Configuration
     private static final String[] AUTHORITIES = {Constants.EPSG, 
Constants.UCUM};
@@ -559,7 +558,7 @@ public class UnitFormat extends Format implements 
javax.measure.format.UnitForma
          * "metres" and "meters" because they are repeated in units such as 
"kilometers".
          */
         uom = uom.replace('_', ' ').toLowerCase(locale);
-        uom = removePlural(CharSequences.toASCII(uom));
+        uom = removePlural(CharSequences.toASCII(uom).toString());
         /*
          * Returns the unit with application of the power if it is part of the 
name.
          * For example, this method interprets "meter2" as "meter" raised to 
power 2.
@@ -602,13 +601,13 @@ appPow: if (unit == null) {
      * The result may not be grammatically correct English, but those strings 
will not be visible to users.
      * This is similar to making a string in lower cases before comparison in 
order to be case-insensitive.
      */
-    private static String removePlural(CharSequence uom) {
-        uom = CharSequences.replace(uom,  DEGREES,  "degree");
-        uom = CharSequences.replace(uom, "radians", "radian");
-        uom = CharSequences.replace(uom, "seconds", "second");
-        uom = CharSequences.replace(uom, "meters",  "meter");
-        uom = CharSequences.replace(uom, "metres",  "metre");
-        return uom.toString();
+    private static String removePlural(String uom) {
+        uom = uom.replace (DEGREES,  "degree");
+        uom = uom.replace("radians", "radian");
+        uom = uom.replace("seconds", "second");
+        uom = uom.replace("meters",  "meter");
+        uom = uom.replace("metres",  "metre");
+        return uom;
     }
 
     /**
@@ -1132,13 +1131,14 @@ appPow: if (unit == null) {
         int end   = symbols.length();
         int start = CharSequences.skipLeadingWhitespaces(symbols, 
position.getIndex(), end);
         if (AUTHORITIES != null) {
-            final Map.Entry<Integer, String> entry = 
DefinitionURI.codeOf("uom", AUTHORITIES, symbols);
+            final Map.Entry<String, String> entry = 
DefinitionURI.codeOf("uom", AUTHORITIES, symbols);
             if (entry != null) {
                 Unit<?> unit = null;
                 NumberFormatException failure = null;
                 final String code = entry.getValue();
-                switch (entry.getKey()) {
-                    case 0: {                   // EPSG
+                final String authority = entry.getKey();
+                switch (authority) {
+                    case Constants.EPSG: {
                         try {
                             unit = Units.valueOfEPSG(Integer.parseInt(code));
                         } catch (NumberFormatException e) {
@@ -1146,7 +1146,7 @@ appPow: if (unit == null) {
                         }
                         break;
                     }
-                    case 1: {                   // UCUM
+                    case Constants.UCUM: {
                         unit = parse(code);
                         break;
                     }
@@ -1156,10 +1156,9 @@ appPow: if (unit == null) {
                     finish(position);
                     return unit;
                 }
-                throw (MeasurementParseException) new 
MeasurementParseException(
-                        Errors.format(Errors.Keys.UnknownUnit_1,
-                        Constants.EPSG + Constants.DEFAULT_SEPARATOR + code), 
symbols,
-                        start + Math.max(0, 
symbols.toString().lastIndexOf(code))).initCause(failure);
+                String message = Errors.format(Errors.Keys.UnknownUnit_1, 
authority + Constants.DEFAULT_SEPARATOR + code);
+                int errorOffset = start + Math.max(0, 
symbols.toString().lastIndexOf(code));
+                throw (MeasurementParseException) new 
MeasurementParseException(message, symbols, errorOffset).initCause(failure);
             }
         }
         /*
diff --git 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/UnitRegistry.java
 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/UnitRegistry.java
index acc77fa74a..0a218e68cb 100644
--- 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/UnitRegistry.java
+++ 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/UnitRegistry.java
@@ -140,10 +140,10 @@ final class UnitRegistry implements SystemOfUnits, 
Serializable {
 
     /**
      * Compares the given keys, taking dimension order in account.
-     * Shall be consistent with {@link #hashCode(Object)}.
+     * Shall be consistent with {@link #hashCodeOrdered(Object)}.
      *
-     * @param  key     a key of one of the types defined in {@link 
#HARD_CODED}.
-     * @param  object  an object to compare with the key. Never null.
+     * @param  key    a key of one of the types defined in {@link #HARD_CODED}.
+     * @param  other  an object to compare with the key. Never null.
      * @return whether the given object are equal.
      */
     private static boolean equalsOrdered(final Object key, final Object other) 
{
@@ -344,7 +344,7 @@ final class UnitRegistry implements SystemOfUnits, 
Serializable {
     @Override
     public Set<Unit<?>> getUnits(final Dimension dimension) {
         ArgumentChecks.ensureNonNull("dimension", dimension);
-        final Set<Unit<?>> filtered = new HashSet<>();
+        final var filtered = new HashSet<Unit<?>>();
         for (final Unit<?> unit : getUnits()) {
             if (dimension.equals(unit.getDimension())) {
                 filtered.add(unit);
diff --git 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/UnitServices.java
 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/UnitServices.java
index 7024a32010..fea5584cca 100644
--- 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/UnitServices.java
+++ 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/UnitServices.java
@@ -243,7 +243,7 @@ public class UnitServices extends ServiceProvider 
implements SystemOfUnitsServic
      */
     @Override
     public Set<String> getAvailableFormatNames(final FormatType type) {
-        final Set<String> names = new HashSet<>(4);
+        final var names = new HashSet<String>(4);
         for (final Enum<?> e : 
org.apache.sis.measure.UnitFormat.Style.values()) {
             names.add(e.name());
         }
@@ -269,7 +269,7 @@ public class UnitServices extends ServiceProvider 
implements SystemOfUnitsServic
     }
 
     /**
-     * Return a factory for the given {@code Quantity} type. In the particular 
case of Apache SIS implementation,
+     * Returns a factory for the given {@code Quantity} type. In the 
particular case of Apache SIS implementation,
      * {@link Quantities#create(double, Unit)} provides a more direct way to 
instantiate quantities.
      *
      * @param  <Q>   compile-time value of the {@code type} argument.
diff --git 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/Units.java 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/Units.java
index 9377d93f79..582e05596a 100644
--- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/Units.java
+++ b/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/Units.java
@@ -1655,6 +1655,7 @@ public final class Units {
      * Unit<Power> dBW = Units.logarithm(Units.WATT).divide(10);
      * }
      *
+     * @param  <Q>   the quantity measured by the unit.
      * @param  unit  the unit from which to convert.
      * @return an unit which is the logarithm in base 10 of the given unit.
      *
@@ -1677,7 +1678,7 @@ public final class Units {
      * must be multiplied by 1000 in order to give the equivalent measurement 
in the "standard" units
      * (here {@link #METRE}).
      *
-     * @param  <Q>   the quantity measured by the unit, or {@code null}.
+     * @param  <Q>   the quantity measured by the unit.
      * @param  unit  the unit for which we want the multiplication factor to 
standard unit, or {@code null}.
      * @return the factor by which to multiply a measurement in the given unit 
in order to get an equivalent
      *         measurement in the standard unit, or NaN if the conversion 
cannot be expressed by a scale factor.
diff --git 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/system/ReferenceQueueConsumer.java
 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/system/ReferenceQueueConsumer.java
index b20f34f7d2..064b58f393 100644
--- 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/system/ReferenceQueueConsumer.java
+++ 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/system/ReferenceQueueConsumer.java
@@ -25,7 +25,7 @@ import org.apache.sis.util.logging.Logging;
 /**
  * A thread processing all {@link Reference} instances enqueued in a {@link 
ReferenceQueue}.
  * This is the central place where weak references produced by the SIS library 
are consumed.
- * This thread will invoke the {@link Disposable#dispose()} method for each 
references
+ * This thread will invoke the {@link Disposable#dispose()} method for each 
reference
  * enqueued by the garbage collector.
  * Those references <strong>must</strong> implement the {@link Disposable} 
interface.
  *
diff --git 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/StringBuilders.java 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/StringBuilders.java
index 1edc5310f2..69d386d305 100644
--- 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/StringBuilders.java
+++ 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/StringBuilders.java
@@ -30,8 +30,8 @@ import org.apache.sis.util.resources.Errors;
  *
  * <h2>Unicode support</h2>
  * Every methods defined in this class work on <i>code points</i> instead of 
characters
- * when appropriate. Consequently, those methods should behave correctly with 
characters outside
- * the <i>Basic Multilingual Plane</i> (BMP).
+ * when appropriate. Consequently, those methods should behave correctly with 
characters
+ * outside the <i>Basic Multilingual Plane</i> (BMP).
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @version 1.6
diff --git 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/collection/WeakValueHashMap.java
 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/collection/WeakValueHashMap.java
index da842d5b1c..84f4e6d716 100644
--- 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/collection/WeakValueHashMap.java
+++ 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/collection/WeakValueHashMap.java
@@ -171,7 +171,7 @@ public class WeakValueHashMap<K,V> extends AbstractMap<K,V> 
{
         @Override
         public boolean equals(final Object other) {
             if (other instanceof Map.Entry<?,?>) {
-                final Map.Entry<?,?> that = (Map.Entry<?,?>) other;
+                final var that = (Map.Entry<?,?>) other;
                 return comparator.test(key, that.getKey()) && 
Objects.equals(get(), that.getValue());
             }
             return false;
@@ -373,6 +373,7 @@ public class WeakValueHashMap<K,V> extends AbstractMap<K,V> 
{
     private synchronized <R> R get(final Object key, final Function<Entry,R> 
getter, final R defaultValue) {
         assert isValid();
         if (key != null) {
+            @SuppressWarnings("LocalVariableHidesMemberVariable")
             final Entry[] table = this.table;
             final int index = (hashFunction.applyAsInt(key) & HASH_MASK) % 
table.length;
             for (Entry e = table[index]; e != null; e = (Entry) e.next) {
@@ -495,8 +496,9 @@ public class WeakValueHashMap<K,V> extends AbstractMap<K,V> 
{
         /*
          * If `value` is already contained in this WeakValueHashMap, we need 
to clear it.
          */
-        V oldValue = null;
+        @SuppressWarnings("LocalVariableHidesMemberVariable")
         Entry[] table = this.table;
+        V oldValue = null;
         final int hash = hashFunction.applyAsInt(key) & HASH_MASK;
         int index = hash % table.length;
         for (Entry e = table[index]; e != null; e = (Entry) e.next) {
diff --git 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/internal/shared/DefinitionURI.java
 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/internal/shared/DefinitionURI.java
index e2b4ff63af..5d430878d8 100644
--- 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/internal/shared/DefinitionURI.java
+++ 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/internal/shared/DefinitionURI.java
@@ -523,17 +523,16 @@ public final class DefinitionURI {
      * @param  type         the expected object type (e.g. {@code "crs"}) in 
lower cases. See class javadoc for a list of types.
      * @param  authorities  the expected authorities, typically {@code 
"EPSG"}. See class javadoc for a list of authorities.
      * @param  uri          the URI to parse.
-     * @return the code part of the given URI together with the authority 
index, or {@code null} if the codespace
+     * @return the code part of the given URI together with the authority as 
key, or {@code null} if the codespace
      *         does not match any given type and authority, the code is empty, 
or the code is followed by parameters.
      */
-    public static Map.Entry<Integer,String> codeOf(final String type, final 
String[] authorities, final CharSequence uri) {
+    public static Map.Entry<String, String> codeOf(final String type, final 
String[] authorities, final CharSequence uri) {
         final int length = uri.length();
         int s = indexOf(uri, SEPARATOR, 0, length);
         if (s >= 0) {
             int from = skipLeadingWhitespaces(uri, 0, s);                   // 
Start of authority part.
             final int span = skipTrailingWhitespaces(uri, from, s) - from;
-            for (int i=0; i < authorities.length; i++) {
-                final String authority = authorities[i];
+            for (final String authority : authorities) {
                 if (span == authority.length() && 
CharSequences.regionMatches(uri, from, authority, true)) {
                     from = skipLeadingWhitespaces(uri, s+1, length);        // 
Start of code part.
                     if (from >= length) {
@@ -556,19 +555,18 @@ public final class DefinitionURI {
                         }
                     }
                     final String code = uri.subSequence(from, 
skipTrailingWhitespaces(uri, from, length)).toString();
-                    return new SimpleEntry<>(i, code);
+                    return new SimpleEntry<>(authority, code);
                 }
             }
             final DefinitionURI def = parse(uri.toString());
             if (def != null && def.parameters == null && 
type.equalsIgnoreCase(def.type)) {
-                for (int i=0; i < authorities.length; i++) {
-                    final String authority = authorities[i];
+                for (final String authority : authorities) {
                     if (authority.equalsIgnoreCase(def.authority)) {
                         String code = def.code;
                         if (code == null) {
                             code = def.version;     // May happen with for 
example "EPSG:4326" instead of "EPSG::4326".
                         }
-                        return new SimpleEntry<>(i, code);
+                        return new SimpleEntry<>(authority, code);
                     }
                 }
             }
diff --git 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/resources/IndexedResourceBundle.java
 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/resources/IndexedResourceBundle.java
index b6710ada55..1365203981 100644
--- 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/resources/IndexedResourceBundle.java
+++ 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/resources/IndexedResourceBundle.java
@@ -553,8 +553,8 @@ public abstract class IndexedResourceBundle extends 
ResourceBundle implements Lo
      * @throws MissingResourceException if no object for the given key can be 
found.
      *
      * @see #getString(String)
-     * @see #getString(short,Object,Object)
-     * @see #getString(short,Object,Object,Object)
+     * @see #getString(short, Object, Object)
+     * @see #getString(short, Object, Object, Object)
      * @see MessageFormat
      */
     public final String getString(final short key, final Object arg0) throws 
MissingResourceException {
diff --git 
a/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/ConventionalUnitTest.java
 
b/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/ConventionalUnitTest.java
index 8283be0b94..1012facd25 100644
--- 
a/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/ConventionalUnitTest.java
+++ 
b/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/ConventionalUnitTest.java
@@ -36,6 +36,7 @@ import static 
org.apache.sis.test.Assertions.assertSerializedEquals;
  *
  * @author  Martin Desruisseaux (Geomatys)
  */
+@SuppressWarnings("exports")
 public final class ConventionalUnitTest extends TestCase {
     /**
      * Creates a new test case.
diff --git 
a/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/LinearConverterTest.java
 
b/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/LinearConverterTest.java
index 40e82afe94..f5c998183e 100644
--- 
a/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/LinearConverterTest.java
+++ 
b/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/LinearConverterTest.java
@@ -32,6 +32,7 @@ import static 
org.apache.sis.test.Assertions.assertSerializedEquals;
  *
  * @author  Martin Desruisseaux (Geomatys)
  */
+@SuppressWarnings("exports")
 public final class LinearConverterTest extends TestCase {
     /**
      * Creates a new test case.
@@ -91,6 +92,7 @@ public final class LinearConverterTest extends TestCase {
      * {@link LinearConverter#coefficients()} methods.
      */
     @Test
+    @SuppressWarnings("deprecation")
     public void testIsIdentityAndLinear() {
         AbstractConverter c = IdentityConverter.INSTANCE;
         assertTrue(c.isIdentity());
diff --git 
a/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/PrefixesTest.java
 
b/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/PrefixesTest.java
index 7a609873cb..6f8f34504e 100644
--- 
a/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/PrefixesTest.java
+++ 
b/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/PrefixesTest.java
@@ -30,6 +30,7 @@ import org.apache.sis.test.TestCase;
  *
  * @author  Martin Desruisseaux (Geomatys)
  */
+@SuppressWarnings("exports")
 public final class PrefixesTest extends TestCase {
     /**
      * Creates a new test case.
diff --git 
a/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/QuantitiesTest.java
 
b/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/QuantitiesTest.java
index 8b8d662b2f..c57764c02c 100644
--- 
a/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/QuantitiesTest.java
+++ 
b/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/QuantitiesTest.java
@@ -32,6 +32,7 @@ import org.apache.sis.test.TestCase;
  *
  * @author  Martin Desruisseaux (Geomatys)
  */
+@SuppressWarnings("exports")
 public final class QuantitiesTest extends TestCase {
     /**
      * Creates a new test case.
diff --git 
a/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/ScalarTest.java 
b/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/ScalarTest.java
index 931530173c..e4b8f2f258 100644
--- 
a/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/ScalarTest.java
+++ 
b/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/ScalarTest.java
@@ -36,6 +36,7 @@ import static 
org.apache.sis.test.Assertions.assertSerializedEquals;
  *
  * @author  Martin Desruisseaux (Geomatys)
  */
+@SuppressWarnings("exports")
 public final class ScalarTest extends TestCase {
     /**
      * Creates a new test case.
diff --git 
a/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/SexagesimalConverterTest.java
 
b/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/SexagesimalConverterTest.java
index c303dfbe48..43d1fd041c 100644
--- 
a/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/SexagesimalConverterTest.java
+++ 
b/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/SexagesimalConverterTest.java
@@ -33,6 +33,7 @@ import org.apache.sis.test.TestCase;
  *
  * @author  Martin Desruisseaux (Geomatys)
  */
+@SuppressWarnings("exports")
 public final class SexagesimalConverterTest extends TestCase {
     /**
      * Tolerance value for the comparisons of floating point numbers.
diff --git 
a/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/SystemUnitTest.java
 
b/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/SystemUnitTest.java
index 69fa8ebc72..1e4687ca48 100644
--- 
a/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/SystemUnitTest.java
+++ 
b/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/SystemUnitTest.java
@@ -42,6 +42,7 @@ import static 
org.apache.sis.test.Assertions.assertSerializedEquals;
  *
  * @author  Martin Desruisseaux (Geomatys)
  */
+@SuppressWarnings("exports")
 public final class SystemUnitTest extends TestCase {
     /**
      * Creates a new test case.
diff --git 
a/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/UnitDimensionTest.java
 
b/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/UnitDimensionTest.java
index ba64cf602f..4cf22fce0e 100644
--- 
a/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/UnitDimensionTest.java
+++ 
b/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/UnitDimensionTest.java
@@ -37,6 +37,7 @@ import static 
org.apache.sis.test.Assertions.assertSerializedEquals;
  *
  * @author  Martin Desruisseaux (Geomatys)
  */
+@SuppressWarnings("exports")
 public final class UnitDimensionTest extends TestCase {
     /**
      * The dimension declared by the base {@link Units} constant.
diff --git 
a/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/UnitFormatTest.java
 
b/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/UnitFormatTest.java
index 4aa647a8ba..5e3eea603f 100644
--- 
a/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/UnitFormatTest.java
+++ 
b/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/UnitFormatTest.java
@@ -40,6 +40,7 @@ import static 
org.apache.sis.test.Assertions.assertMessageContains;
  * @author  Martin Desruisseaux (Geomatys)
  * @author  Alexis Manin (Geomatys)
  */
+@SuppressWarnings("exports")
 public final class UnitFormatTest extends TestCase {
     /**
      * Creates a new test case.
diff --git 
a/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/UnitServicesTest.java
 
b/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/UnitServicesTest.java
index 35844ea362..afadc19c53 100644
--- 
a/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/UnitServicesTest.java
+++ 
b/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/UnitServicesTest.java
@@ -35,6 +35,7 @@ import static org.apache.sis.test.Assertions.assertSetEquals;
  *
  * @author  Martin Desruisseaux (Geomatys)
  */
+@SuppressWarnings("exports")
 public final class UnitServicesTest extends TestCase {
     /**
      * Creates a new test case.
diff --git 
a/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/UnitsTest.java 
b/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/UnitsTest.java
index 53aa9107e2..38e7857e9a 100644
--- 
a/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/UnitsTest.java
+++ 
b/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/UnitsTest.java
@@ -37,6 +37,7 @@ import static 
org.apache.sis.test.Assertions.assertSerializedEquals;
  * @author  Martin Desruisseaux (Geomatys)
  * @author  Alexis Manin (Geomatys)
  */
+@SuppressWarnings("exports")
 public final class UnitsTest extends TestCase {
     /**
      * Creates a new test case.
diff --git 
a/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/collection/WeakHashSetTest.java
 
b/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/collection/WeakHashSetTest.java
index 04071b1c9a..436af5294c 100644
--- 
a/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/collection/WeakHashSetTest.java
+++ 
b/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/collection/WeakHashSetTest.java
@@ -31,6 +31,7 @@ import static org.apache.sis.test.Assertions.assertSetEquals;
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  */
+@SuppressWarnings("exports")
 public final class WeakHashSetTest extends TestCaseWithGC {
     /**
      * The size of the test sets to be created.
@@ -57,10 +58,10 @@ public final class WeakHashSetTest extends TestCaseWithGC {
     public void testStrongReferences() {
         final var random = new Random();
         for (int pass=0; pass<NUM_RETRY; pass++) {
-            final WeakHashSet<IntObject> weakSet = new 
WeakHashSet<>(IntObject.class);
-            final HashSet<IntObject> strongSet = new HashSet<>();
+            final var weakSet = new WeakHashSet<IntObject>(IntObject.class);
+            final var strongSet = new HashSet<IntObject>();
             for (int i=0; i<SAMPLE_SIZE; i++) {
-                final IntObject value = new 
IntObject(random.nextInt(SAMPLE_SIZE));
+                final var value = new IntObject(random.nextInt(SAMPLE_SIZE));
                 if (random.nextBoolean()) {
                     /*
                      * Tests addition.
@@ -99,8 +100,8 @@ public final class WeakHashSetTest extends TestCaseWithGC {
     public void testWeakReferences() throws InterruptedException {
         final var random = new Random();
         for (int pass=0; pass<NUM_RETRY; pass++) {
-            final WeakHashSet<IntObject> weakSet = new 
WeakHashSet<>(IntObject.class);
-            final HashSet<IntObject> strongSet = new HashSet<>();
+            final var weakSet = new WeakHashSet<IntObject>(IntObject.class);
+            final var strongSet = new HashSet<IntObject>();
             for (int i=0; i<SAMPLE_SIZE; i++) {
                 final IntObject value = new 
IntObject(random.nextInt(SAMPLE_SIZE));     // Really need new instances.
                 if (random.nextBoolean()) {
@@ -168,7 +169,7 @@ public final class WeakHashSetTest extends TestCaseWithGC {
      */
     @Test
     public void testWithArrayElements() {
-        final WeakHashSet<int[]> weakSet = new WeakHashSet<>(int[].class);
+        final var weakSet = new WeakHashSet<int[]>(int[].class);
         final int[] array = new int[] {2, 5, 3};
         assertTrue (weakSet.add(array));
         assertFalse(weakSet.add(array));
diff --git 
a/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/collection/WeakValueHashMapTest.java
 
b/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/collection/WeakValueHashMapTest.java
index f5ad861fd7..1694263635 100644
--- 
a/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/collection/WeakValueHashMapTest.java
+++ 
b/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/collection/WeakValueHashMapTest.java
@@ -33,6 +33,7 @@ import static org.apache.sis.test.Assertions.assertMapEquals;
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  */
+@SuppressWarnings("exports")
 public final class WeakValueHashMapTest extends TestCaseWithGC {
     /**
      * The size of the test sets to be created.
@@ -70,7 +71,7 @@ public final class WeakValueHashMapTest extends 
TestCaseWithGC {
         final Random random = new Random();
         for (int pass=0; pass<NUM_RETRY; pass++) {
             weakMap.clear();
-            final HashMap<Integer,IntObject> strongMap = new HashMap<>();
+            final var strongMap = new HashMap<Integer, IntObject>();
             for (int i=0; i<SAMPLE_SIZE; i++) {
                 final Integer   key   = random.nextInt(SAMPLE_SIZE);
                 final IntObject value = new 
IntObject(random.nextInt(SAMPLE_SIZE));
@@ -111,7 +112,7 @@ public final class WeakValueHashMapTest extends 
TestCaseWithGC {
         final Random random = new Random();
         for (int pass=0; pass<NUM_RETRY; pass++) {
             weakMap.clear();
-            final HashMap<Integer,IntObject> strongMap = new HashMap<>();
+            final var strongMap = new HashMap<Integer, IntObject>();
             for (int i=0; i<SAMPLE_SIZE; i++) {
                 final Integer   key   = random.nextInt(SAMPLE_SIZE);
                 final IntObject value = new 
IntObject(random.nextInt(SAMPLE_SIZE));     // Really need new instances.
@@ -174,7 +175,7 @@ public final class WeakValueHashMapTest extends 
TestCaseWithGC {
      */
     @Test
     public void testWithArrayKeys() {
-        final WeakValueHashMap<int[],IntObject> weakMap = new 
WeakValueHashMap<>(int[].class);
+        final var weakMap = new WeakValueHashMap<int[], 
IntObject>(int[].class);
         final int[] k1 = new int[] {2, 5, 3};
         final int[] k2 = new int[] {2, 5, 4};
         final IntObject v1 = new IntObject(1);
@@ -194,7 +195,7 @@ public final class WeakValueHashMapTest extends 
TestCaseWithGC {
      */
     @Test
     public void testIdentityComparisons() {
-        final WeakValueHashMap<IntObject,IntObject> weakMap = new 
WeakValueHashMap<>(IntObject.class, true);
+        final var weakMap = new WeakValueHashMap<IntObject, 
IntObject>(IntObject.class, true);
         final IntObject k1 = new IntObject(10);
         final IntObject k2 = new IntObject(20);
         final IntObject k3 = new IntObject(10);         // Really want a new 
instance.
@@ -215,8 +216,8 @@ public final class WeakValueHashMapTest extends 
TestCaseWithGC {
      */
     @Test
     public void testOptionalMethods() {
-        final WeakValueHashMap<Integer,Integer> weakMap = new 
WeakValueHashMap<>(Integer.class);
-        final HashMap<Integer,Integer> reference = new HashMap<>();
+        final var weakMap = new 
WeakValueHashMap<Integer,Integer>(Integer.class);
+        final var reference = new HashMap<Integer, Integer>();
         final Random random = TestUtilities.createRandomNumberGenerator();
         for (int i=0; i<100; i++) {
             final Integer key   = random.nextInt(10);
diff --git 
a/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/internal/shared/DefinitionURITest.java
 
b/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/internal/shared/DefinitionURITest.java
index e9cbc851c6..c1347acb05 100644
--- 
a/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/internal/shared/DefinitionURITest.java
+++ 
b/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/internal/shared/DefinitionURITest.java
@@ -201,11 +201,11 @@ public final class DefinitionURITest extends TestCase {
      * with a single authority.
      */
     private static String codeOf(final String type, final String authority, 
final CharSequence uri) {
-        Map.Entry<Integer,String> entry = DefinitionURI.codeOf(type, new 
String[] {authority}, uri);
+        Map.Entry<String, String> entry = DefinitionURI.codeOf(type, new 
String[] {authority}, uri);
         if (entry == null) {
             return null;
         }
-        assertEquals(0, entry.getKey());
+        assertEquals(authority, entry.getKey());
         return entry.getValue();
     }
 


Reply via email to