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 929bc5d9c1651560fd3ca8595135ca8b2cad28ad
Author: Martin Desruisseaux <martin.desruisse...@geomatys.com>
AuthorDate: Sat Dec 10 17:23:00 2022 +0100

    Delete some placeholder defined in the `JDK9` internal class,
    now replaced by their standard Java 11 counterparts.
---
 .../sis/coverage/grid/BufferedGridCoverage.java    |   3 +-
 .../java/org/apache/sis/image/ImageCombiner.java   |   5 +-
 .../java/org/apache/sis/image/PlanarImage.java     |  15 +--
 .../main/java/org/apache/sis/image/TileCache.java  |   3 +-
 .../sis/internal/coverage/j2d/ImageUtilities.java  |   2 +-
 .../sis/internal/feature/GeometryFactories.java    |   3 +-
 .../internal/processing/image/TiledProcess.java    |   3 +-
 .../gazetteer/MilitaryGridReferenceSystem.java     |   3 +-
 .../provider/ParameterNameTableGenerator.java      |   3 +-
 .../java/org/apache/sis/internal/jdk9/JDK9.java    | 110 +--------------------
 .../org/apache/sis/internal/jdk9/package-info.java |   2 +-
 .../main/java/org/apache/sis/math/Fraction.java    |  13 ++-
 .../java/org/apache/sis/math/MathFunctions.java    |   2 +-
 .../src/main/java/org/apache/sis/math/Vector.java  |   5 +-
 .../src/main/java/org/apache/sis/setup/About.java  |   3 +-
 .../java/org/apache/sis/util/logging/Logging.java  |   3 +-
 .../org/apache/sis/test/ProjectDirectories.java    |   3 +-
 .../storage/inflater/CompressionChannel.java       |   3 +-
 .../sis/storage/geotiff/CompressedSubset.java      |   2 +-
 .../org/apache/sis/storage/geotiff/DataSubset.java |   2 +-
 .../sis/storage/geotiff/ReversedBitsChannel.java   |   2 +-
 .../apache/sis/internal/netcdf/RasterResource.java |   3 +-
 .../sis/internal/sql/postgis/RasterReader.java     |   3 +-
 .../sis/internal/storage/TiledGridCoverage.java    |   2 +-
 .../sis/internal/storage/esri/RawRasterReader.java |   2 +-
 .../apache/sis/internal/storage/io/ByteWriter.java |   5 +-
 .../sis/internal/storage/wkt/FirstKeywordPeek.java |   2 +-
 .../sis/storage/AbstractGridCoverageResource.java  |   3 +-
 .../sis/internal/storage/gpx/UpdaterTest.java      |   2 +-
 29 files changed, 44 insertions(+), 168 deletions(-)

diff --git 
a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/BufferedGridCoverage.java
 
b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/BufferedGridCoverage.java
index f966cc1a1f..07a0549ee3 100644
--- 
a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/BufferedGridCoverage.java
+++ 
b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/BufferedGridCoverage.java
@@ -39,7 +39,6 @@ import org.apache.sis.util.collection.Cache;
 import org.apache.sis.image.DataType;
 
 // Branch-specific imports
-import org.apache.sis.internal.jdk9.JDK9;
 import org.opengis.coverage.CannotEvaluateException;
 import org.opengis.coverage.PointOutsideCoverageException;
 
@@ -167,7 +166,7 @@ public class BufferedGridCoverage extends GridCoverage {
          */
         final GridExtent extent = domain.getExtent();
         final long expectedSize = getSampleCount(extent, numBands);
-        final long bufferSize = JDK9.multiplyFull(data.getSize(), numBanks);
+        final long bufferSize = Math.multiplyFull(data.getSize(), numBanks);
         if (bufferSize < expectedSize) {
             final StringBuilder b = new StringBuilder();
             for (int i=0; i < extent.getDimension(); i++) {
diff --git 
a/core/sis-feature/src/main/java/org/apache/sis/image/ImageCombiner.java 
b/core/sis-feature/src/main/java/org/apache/sis/image/ImageCombiner.java
index 2f711ad60e..61f7da9fe9 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/image/ImageCombiner.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/image/ImageCombiner.java
@@ -29,7 +29,6 @@ import org.apache.sis.internal.coverage.j2d.ImageLayout;
 import org.apache.sis.internal.coverage.j2d.ImageUtilities;
 import org.apache.sis.internal.coverage.j2d.TileOpExecutor;
 import org.apache.sis.internal.util.Numerics;
-import org.apache.sis.internal.jdk9.JDK9;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.measure.Units;
 
@@ -260,8 +259,8 @@ public class ImageCombiner implements 
Consumer<RenderedImage> {
         final long tileGridYOffset = destination.getTileGridYOffset();
         final int  minTileX        = Math.toIntExact(Math.floorDiv((bounds.x - 
tileGridXOffset), tileWidth));
         final int  minTileY        = Math.toIntExact(Math.floorDiv((bounds.y - 
tileGridYOffset), tileHeight));
-        final int  minX            = 
Math.toIntExact(JDK9.multiplyFull(minTileX, tileWidth)  + tileGridXOffset);
-        final int  minY            = 
Math.toIntExact(JDK9.multiplyFull(minTileY, tileHeight) + tileGridYOffset);
+        final int  minX            = 
Math.toIntExact(Math.multiplyFull(minTileX, tileWidth)  + tileGridXOffset);
+        final int  minY            = 
Math.toIntExact(Math.multiplyFull(minTileY, tileHeight) + tileGridYOffset);
         /*
          * Expand the target bounds until it contains an integer number of 
tiles, computed using the size
          * of destination tiles. We have to do that because the resample 
operation below is not free to
diff --git 
a/core/sis-feature/src/main/java/org/apache/sis/image/PlanarImage.java 
b/core/sis-feature/src/main/java/org/apache/sis/image/PlanarImage.java
index 805a8e1dcf..cca4151bfb 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/image/PlanarImage.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/image/PlanarImage.java
@@ -36,9 +36,10 @@ import org.apache.sis.internal.util.Numerics;
 import org.apache.sis.internal.coverage.j2d.ImageUtilities;
 import org.apache.sis.internal.coverage.j2d.TileOpExecutor;
 import org.apache.sis.internal.coverage.j2d.ColorModelFactory;
-import org.apache.sis.internal.jdk9.JDK9;
 import org.apache.sis.coverage.grid.GridGeometry;       // For javadoc
 
+import static java.lang.Math.multiplyFull;
+
 
 /**
  * Base class of {@link RenderedImage} implementations in Apache SIS.
@@ -384,7 +385,7 @@ public abstract class PlanarImage implements RenderedImage {
     @Override
     public int getTileGridXOffset() {
         // We may have temporary `int` overflow after multiplication but exact 
result after addition.
-        return Math.toIntExact(getMinX() - JDK9.multiplyFull(getMinTileX(), 
getTileWidth()));
+        return Math.toIntExact(getMinX() - multiplyFull(getMinTileX(), 
getTileWidth()));
     }
 
     /**
@@ -398,7 +399,7 @@ public abstract class PlanarImage implements RenderedImage {
      */
     @Override
     public int getTileGridYOffset() {
-        return Math.toIntExact(getMinY() - JDK9.multiplyFull(getMinTileY(), 
getTileHeight()));
+        return Math.toIntExact(getMinY() - multiplyFull(getMinTileY(), 
getTileHeight()));
     }
 
     /**
@@ -576,16 +577,16 @@ public abstract class PlanarImage implements 
RenderedImage {
             if (sm.getWidth()  < tileWidth)  return "tileWidth";
             if (sm.getHeight() < tileHeight) return "tileHeight";
         }
-        long remainder = JDK9.multiplyFull(getNumXTiles(), tileWidth) - 
getWidth();
+        long remainder = multiplyFull(getNumXTiles(), tileWidth) - getWidth();
         if (remainder != 0) {
             return (remainder >= 0 && remainder < tileWidth) ? "width" : 
"numXTiles";
         }
-        remainder = JDK9.multiplyFull(getNumYTiles(), tileHeight) - 
getHeight();
+        remainder = multiplyFull(getNumYTiles(), tileHeight) - getHeight();
         if (remainder != 0) {
             return (remainder >= 0 && remainder < tileHeight) ? "height" : 
"numYTiles";
         }
-        if (JDK9.multiplyFull(getMinTileX(), tileWidth)  + 
getTileGridXOffset() != getMinX()) return "tileX";
-        if (JDK9.multiplyFull(getMinTileY(), tileHeight) + 
getTileGridYOffset() != getMinY()) return "tileY";
+        if (multiplyFull(getMinTileX(), tileWidth)  + getTileGridXOffset() != 
getMinX()) return "tileX";
+        if (multiplyFull(getMinTileY(), tileHeight) + getTileGridYOffset() != 
getMinY()) return "tileY";
         return null;
     }
 
diff --git a/core/sis-feature/src/main/java/org/apache/sis/image/TileCache.java 
b/core/sis-feature/src/main/java/org/apache/sis/image/TileCache.java
index d009045eef..817a82cbfd 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/image/TileCache.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/image/TileCache.java
@@ -23,7 +23,6 @@ import java.lang.ref.Reference;
 import org.apache.sis.util.collection.Cache;
 import org.apache.sis.internal.util.Numerics;
 import org.apache.sis.internal.feature.Resources;
-import org.apache.sis.internal.jdk9.JDK9;
 
 
 /**
@@ -69,7 +68,7 @@ final class TileCache extends Cache<TileCache.Key, Raster> {
      */
     @Override
     protected int cost​(final Raster tile) {
-        long numBits = JDK9.multiplyFull(tile.getWidth(), tile.getHeight()) * 
tile.getNumBands();
+        long numBits = Math.multiplyFull(tile.getWidth(), tile.getHeight()) * 
tile.getNumBands();
         final DataBuffer buffer = tile.getDataBuffer();
         if (buffer != null) try {
             numBits *= DataBuffer.getDataTypeSize(buffer.getDataType());
diff --git 
a/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/j2d/ImageUtilities.java
 
b/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/j2d/ImageUtilities.java
index a1c1f60632..e76d3602fd 100644
--- 
a/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/j2d/ImageUtilities.java
+++ 
b/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/j2d/ImageUtilities.java
@@ -42,8 +42,8 @@ import static java.lang.Math.rint;
 import static java.lang.Math.floorDiv;
 import static java.lang.Math.addExact;
 import static java.lang.Math.toIntExact;
+import static java.lang.Math.multiplyFull;
 import static java.util.logging.Logger.getLogger;
-import static org.apache.sis.internal.jdk9.JDK9.multiplyFull;
 import static org.apache.sis.internal.util.Numerics.COMPARISON_THRESHOLD;
 
 
diff --git 
a/core/sis-feature/src/main/java/org/apache/sis/internal/feature/GeometryFactories.java
 
b/core/sis-feature/src/main/java/org/apache/sis/internal/feature/GeometryFactories.java
index 6b8037ebae..c1e28d6fac 100644
--- 
a/core/sis-feature/src/main/java/org/apache/sis/internal/feature/GeometryFactories.java
+++ 
b/core/sis-feature/src/main/java/org/apache/sis/internal/feature/GeometryFactories.java
@@ -18,7 +18,6 @@ package org.apache.sis.internal.feature;
 
 import java.util.logging.Level;
 import java.util.logging.LogRecord;
-import org.apache.sis.internal.jdk9.JDK9;
 import org.apache.sis.internal.system.Loggers;
 import org.apache.sis.util.logging.Logging;
 
@@ -56,7 +55,7 @@ final class GeometryFactories {
      * The last registered library will be the default implementation.
      */
     private static Geometries<?> link(final Geometries<?> previous, final 
String name) {
-        final String classname = JDK9.getPackageName(GeometryFactories.class) 
+ '.' + name + ".Factory";
+        final String classname = GeometryFactories.class.getPackageName() + 
'.' + name + ".Factory";
         final Geometries<?> factory;
         try {
             factory = (Geometries<?>) 
Class.forName(classname).getField("INSTANCE").get(null);
diff --git 
a/core/sis-feature/src/main/java/org/apache/sis/internal/processing/image/TiledProcess.java
 
b/core/sis-feature/src/main/java/org/apache/sis/internal/processing/image/TiledProcess.java
index 662128f09b..326c7ea4a6 100644
--- 
a/core/sis-feature/src/main/java/org/apache/sis/internal/processing/image/TiledProcess.java
+++ 
b/core/sis-feature/src/main/java/org/apache/sis/internal/processing/image/TiledProcess.java
@@ -24,7 +24,6 @@ import java.util.concurrent.locks.ReentrantLock;
 import java.util.concurrent.atomic.AtomicInteger;
 import org.apache.sis.internal.system.CommonExecutor;
 import org.apache.sis.internal.util.Numerics;
-import org.apache.sis.internal.jdk9.JDK9;
 import org.apache.sis.image.PixelIterator;
 import org.apache.sis.util.ArgumentChecks;
 
@@ -153,7 +152,7 @@ public abstract class TiledProcess<R> {
         final int height = data.getHeight();
         int  numTileX = Math.max(width  / MIN_TILE_SIZE, 1);
         int  numTileY = Math.max(height / MIN_TILE_SIZE, 1);
-        long numTiles = JDK9.multiplyFull(numTileX, numTileY);
+        long numTiles = Math.multiplyFull(numTileX, numTileY);
         if (numTiles > CommonExecutor.PARALLELISM) {
             final double r = Math.sqrt(CommonExecutor.PARALLELISM / (double) 
numTiles);     // Always < 1.
             if (numTileX >= numTileY) {
diff --git 
a/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java
 
b/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java
index 38a484c4ff..d80d5ca66d 100644
--- 
a/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java
+++ 
b/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java
@@ -83,7 +83,6 @@ import org.apache.sis.measure.Units;
 import static java.util.logging.Logger.getLogger;
 
 // Branch-dependent imports
-import org.apache.sis.internal.jdk9.JDK9;
 import org.opengis.metadata.citation.Party;
 import org.opengis.referencing.gazetteer.Location;
 import org.opengis.referencing.gazetteer.LocationType;
@@ -1294,7 +1293,7 @@ public class MilitaryGridReferenceSystem extends 
ReferencingByIdentifiers {
          */
         @Override
         public long estimateSize() {
-            return (xEnd - (long) gridX) * Math.abs(yEnd - (long) yStart) / 
JDK9.multiplyFull(step, step);
+            return (xEnd - (long) gridX) * Math.abs(yEnd - (long) yStart) / 
Math.multiplyFull(step, step);
         }
 
         /**
diff --git 
a/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ParameterNameTableGenerator.java
 
b/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ParameterNameTableGenerator.java
index 5bb278871d..1d2ed9047e 100644
--- 
a/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ParameterNameTableGenerator.java
+++ 
b/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ParameterNameTableGenerator.java
@@ -32,7 +32,6 @@ import org.opengis.metadata.Identifier;
 import org.apache.sis.referencing.NamedIdentifier;
 import org.apache.sis.parameter.DefaultParameterDescriptor;
 import org.apache.sis.test.ProjectDirectories;
-import org.apache.sis.internal.jdk9.JDK9;
 import org.apache.sis.measure.Angle;
 import org.apache.sis.measure.Latitude;
 import org.apache.sis.measure.Longitude;
@@ -142,7 +141,7 @@ public final class ParameterNameTableGenerator extends 
SimpleFileVisitor<Path> {
     private Class<?> getClass(final Path file) throws ClassNotFoundException {
         String name = file.getFileName().toString();
         name = name.substring(0, name.lastIndexOf('.'));    // Remove the 
".java" suffix.
-        name = JDK9.getPackageName(getClass()) + '.' + name;
+        name = getClass().getPackageName() + '.' + name;
         return Class.forName(name);
     }
 
diff --git 
a/core/sis-utility/src/main/java/org/apache/sis/internal/jdk9/JDK9.java 
b/core/sis-utility/src/main/java/org/apache/sis/internal/jdk9/JDK9.java
index 047b6f326b..8d89029b27 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/internal/jdk9/JDK9.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/internal/jdk9/JDK9.java
@@ -16,16 +16,7 @@
  */
 package org.apache.sis.internal.jdk9;
 
-import java.io.IOException;
-import java.nio.Buffer;
 import java.nio.ByteBuffer;
-import java.nio.DoubleBuffer;
-import java.nio.FloatBuffer;
-import java.nio.IntBuffer;
-import java.nio.LongBuffer;
-import java.nio.ShortBuffer;
-import java.nio.file.Files;
-import java.nio.file.Path;
 import java.util.Arrays;
 import java.util.Set;
 import java.util.List;
@@ -34,9 +25,6 @@ import java.util.HashSet;
 import java.util.HashMap;
 import java.util.LinkedHashSet;
 import java.util.Map;
-import java.util.Optional;
-import java.util.StringJoiner;
-import java.util.function.Consumer;
 import java.util.stream.Stream;
 import org.apache.sis.internal.util.CollectionsExt;
 import org.apache.sis.internal.util.UnmodifiableArrayList;
@@ -47,7 +35,7 @@ import org.apache.sis.internal.util.UnmodifiableArrayList;
  * This file will be deleted on the SIS JDK9 branch.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @since   1.1
+ * @since   1.4
  * @version 0.8
  * @module
  */
@@ -58,33 +46,6 @@ public final class JDK9 {
     private JDK9() {
     }
 
-    /**
-     * Placeholder for {@link Optional#ifPresentOrElse(Consumer, Runnable)}.
-     */
-    public static <T> void ifPresentOrElse(Optional<T> optional, Consumer<? 
super T> action, Runnable emptyAction) {
-        if (optional.isPresent()) {
-            action.accept(optional.get());
-        } else {
-            emptyAction.run();
-        }
-    }
-
-    /**
-     * Placeholder for {@code List.of(...)}.
-     *
-     * @param  <E>       type of elements.
-     * @param  elements  the elements to put in an unmodifiable list.
-     * @return an unmodifiable list of the given elements.
-     */
-    @SafeVarargs
-    public static <E> List<E> listOf(final E... elements) {
-        switch (elements.length) {
-            case 0:  return Collections.emptyList();
-            case 1:  return Collections.singletonList(elements[0]);
-            default: return UnmodifiableArrayList.wrap(elements);
-        }
-    }
-
     /**
      * Placeholder for {@code Set.of(...)}.
      *
@@ -136,38 +97,6 @@ public final class JDK9 {
         return map.size() < 2 ? CollectionsExt.compact(map) : new 
HashMap<>(map);
     }
 
-    /**
-     * Place holder for {@code Buffer.slice()}.
-     *
-     * @param  b the buffer to slice.
-     * @return the sliced buffer.
-     */
-    public static Buffer slice(Buffer b) {
-        if (b instanceof ByteBuffer)   return ((ByteBuffer) b).slice();
-        if (b instanceof ShortBuffer)  return ((ShortBuffer) b).slice();
-        if (b instanceof IntBuffer)    return ((IntBuffer) b).slice();
-        if (b instanceof LongBuffer)   return ((LongBuffer) b).slice();
-        if (b instanceof FloatBuffer)  return ((FloatBuffer) b).slice();
-        if (b instanceof DoubleBuffer) return ((DoubleBuffer) b).slice();
-        throw new IllegalArgumentException();
-    }
-
-    /**
-     * Place holder for {@code Buffer.duplicate()}.
-     *
-     * @param  b the buffer to duplicate.
-     * @return the duplicate buffer.
-     */
-    public static Buffer duplicate(Buffer b) {
-        if (b instanceof ByteBuffer)   return ((ByteBuffer) b).duplicate();
-        if (b instanceof ShortBuffer)  return ((ShortBuffer) b).duplicate();
-        if (b instanceof IntBuffer)    return ((IntBuffer) b).duplicate();
-        if (b instanceof LongBuffer)   return ((LongBuffer) b).duplicate();
-        if (b instanceof FloatBuffer)  return ((FloatBuffer) b).duplicate();
-        if (b instanceof DoubleBuffer) return ((DoubleBuffer) b).duplicate();
-        throw new IllegalArgumentException();
-    }
-
     /**
      * Place holder for {@code ByteBuffer.get(int, byte[])}.
      *
@@ -194,34 +123,6 @@ public final class JDK9 {
         }
     }
 
-    /**
-     * Place holder for {@code Class.getPackageName()}.
-     *
-     * @param  c  the class for which to get the package name.
-     * @return the name of the package.
-     */
-    public static String getPackageName(Class<?> c) {
-        Class<?> outer;
-        while ((outer = c.getEnclosingClass()) != null) {
-            c = outer;
-        }
-        String name = c.getName();
-        final int separator = name.lastIndexOf('.');
-        name = (separator >= 1) ? name.substring(0, separator) : "";
-        return name;
-    }
-
-    /**
-     * Place holder for {@code Math.multiplyFull​(int, int)}.
-     *
-     * @param  x  the first value.
-     * @param  y  the second value.
-     * @return Product of the two values.
-     */
-    public static long multiplyFull​(int x, int y) {
-        return ((long) x) * ((long) y);
-    }
-
     /**
      * Place holder for {@link java.util.Arrays} method added in JDK9.
      * This placeholder does not perform range check (JDK9 method does).
@@ -354,13 +255,4 @@ public final class JDK9 {
     public static <T> List<T> toList(final Stream<T> s) {
         return (List<T>) UnmodifiableArrayList.wrap(s.toArray());
     }
-
-    /**
-     * Placeholder for {@link Files#readString(Path)}.
-     */
-    public static String readString(final Path path) throws IOException {
-        final StringJoiner j = new StringJoiner("\n");
-        Files.readAllLines(path).forEach(j::add);
-        return j.toString();
-    }
 }
diff --git 
a/core/sis-utility/src/main/java/org/apache/sis/internal/jdk9/package-info.java 
b/core/sis-utility/src/main/java/org/apache/sis/internal/jdk9/package-info.java
index 2409866171..72b87f3ba7 100644
--- 
a/core/sis-utility/src/main/java/org/apache/sis/internal/jdk9/package-info.java
+++ 
b/core/sis-utility/src/main/java/org/apache/sis/internal/jdk9/package-info.java
@@ -24,7 +24,7 @@
  * may change in incompatible ways in any future version without notice.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @since   1.2
+ * @since   1.4
  * @version 0.8
  * @module
  */
diff --git a/core/sis-utility/src/main/java/org/apache/sis/math/Fraction.java 
b/core/sis-utility/src/main/java/org/apache/sis/math/Fraction.java
index f2f086897d..9dddc00600 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/math/Fraction.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/math/Fraction.java
@@ -21,7 +21,6 @@ import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.collection.WeakHashSet;
 import org.apache.sis.internal.util.Numerics;
-import org.apache.sis.internal.jdk9.JDK9;
 
 
 /**
@@ -320,8 +319,8 @@ public final class Fraction extends Number implements 
Comparable<Fraction>, Seri
      * @throws ArithmeticException if the result overflows.
      */
     public Fraction multiply(final Fraction other) {
-        return simplify(this, JDK9.multiplyFull(numerator,   other.numerator),
-                              JDK9.multiplyFull(denominator, 
other.denominator));
+        return simplify(this, Math.multiplyFull(numerator,   other.numerator),
+                              Math.multiplyFull(denominator, 
other.denominator));
     }
 
     /**
@@ -332,8 +331,8 @@ public final class Fraction extends Number implements 
Comparable<Fraction>, Seri
      * @throws ArithmeticException if the result overflows.
      */
     public Fraction divide(final Fraction other) {
-        return simplify(this, JDK9.multiplyFull(numerator,   
other.denominator),
-                              JDK9.multiplyFull(denominator, other.numerator));
+        return simplify(this, Math.multiplyFull(numerator,   
other.denominator),
+                              Math.multiplyFull(denominator, other.numerator));
     }
 
     /**
@@ -507,8 +506,8 @@ public final class Fraction extends Number implements 
Comparable<Fraction>, Seri
      */
     @Override
     public int compareTo(final Fraction other) {
-        return Long.signum(JDK9.multiplyFull(numerator, other.denominator)
-                         - JDK9.multiplyFull(other.numerator, denominator));
+        return Long.signum(Math.multiplyFull(numerator, other.denominator)
+                         - Math.multiplyFull(other.numerator, denominator));
     }
 
     /**
diff --git 
a/core/sis-utility/src/main/java/org/apache/sis/math/MathFunctions.java 
b/core/sis-utility/src/main/java/org/apache/sis/math/MathFunctions.java
index dd7cdd3720..09fe2d2dc9 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/math/MathFunctions.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/math/MathFunctions.java
@@ -25,13 +25,13 @@ import org.apache.sis.internal.util.DoubleDouble;
 
 import static java.lang.Math.abs;
 import static java.lang.Math.sqrt;
+import static java.lang.Math.multiplyFull;
 import static java.lang.Float.intBitsToFloat;
 import static java.lang.Float.floatToIntBits;
 import static java.lang.Float.floatToRawIntBits;
 import static java.lang.Double.longBitsToDouble;
 import static java.lang.Double.doubleToLongBits;
 import static java.lang.Double.doubleToRawLongBits;
-import static org.apache.sis.internal.jdk9.JDK9.multiplyFull;
 import static org.apache.sis.internal.util.Numerics.SIGN_BIT_MASK;
 import static org.apache.sis.internal.util.Numerics.SIGNIFICAND_SIZE;
 
diff --git a/core/sis-utility/src/main/java/org/apache/sis/math/Vector.java 
b/core/sis-utility/src/main/java/org/apache/sis/math/Vector.java
index 252bf05812..759d58d1ec 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/math/Vector.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/math/Vector.java
@@ -24,7 +24,6 @@ import java.util.RandomAccess;
 import java.util.StringJoiner;
 import java.util.Optional;
 import java.util.function.IntSupplier;
-import org.apache.sis.internal.jdk9.JDK9;
 import org.apache.sis.measure.NumberRange;
 import org.apache.sis.util.Numbers;
 import org.apache.sis.util.ArraysExt;
@@ -92,7 +91,7 @@ import static 
org.apache.sis.util.ArgumentChecks.ensureValidIndex;
  * method and by accepting buffer in the {@link #create(Object, boolean)} 
method.</div>
  *
  * @author  Martin Desruisseaux (MPO, Geomatys)
- * @version 1.1
+ * @version 1.4
  *
  * @see org.apache.sis.util.collection.IntegerList
  *
@@ -1076,7 +1075,7 @@ search:     for (;;) {
         @Override
         public Optional<Buffer> buffer() {
             if (step == 1) {
-                Vector.this.buffer().map((b) -> 
JDK9.slice(b.position(first).limit(first + length)));
+                Vector.this.buffer().map((b) -> b.position(first).limit(first 
+ length).slice());
             }
             return super.buffer();
         }
diff --git a/core/sis-utility/src/main/java/org/apache/sis/setup/About.java 
b/core/sis-utility/src/main/java/org/apache/sis/setup/About.java
index 67ed4f580e..021675162d 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/setup/About.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/setup/About.java
@@ -56,7 +56,6 @@ import org.apache.sis.internal.system.Loggers;
 import org.apache.sis.internal.system.Modules;
 import org.apache.sis.internal.system.Shutdown;
 import org.apache.sis.internal.system.DataDirectory;
-import org.apache.sis.internal.jdk9.JDK9;
 
 import static java.lang.System.getProperty;
 import static java.util.logging.Logger.getLogger;
@@ -351,7 +350,7 @@ fill:   for (int i=0; ; i++) {
                         nameKey = Vocabulary.Keys.Implementation;
                         value = "java.util.logging";
                         for (final Handler handler : 
getLogger("").getHandlers()) {
-                            final String c = 
JDK9.getPackageName(handler.getClass());
+                            final String c = 
handler.getClass().getPackageName();
                             if (!value.equals(c)) {
                                 value = c;
                                 break;
diff --git 
a/core/sis-utility/src/main/java/org/apache/sis/util/logging/Logging.java 
b/core/sis-utility/src/main/java/org/apache/sis/util/logging/Logging.java
index da0e3fb8a4..11d77db468 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/util/logging/Logging.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/util/logging/Logging.java
@@ -24,7 +24,6 @@ import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.Static;
 import org.apache.sis.util.Exceptions;
 import org.apache.sis.util.Classes;
-import org.apache.sis.internal.jdk9.JDK9;
 import org.apache.sis.internal.system.Modules;
 
 
@@ -75,7 +74,7 @@ public final class Logging extends Static {
      */
     public static Logger getLogger(final Class<?> source) {
         ArgumentChecks.ensureNonNull("source", source);
-        String name = JDK9.getPackageName(source);
+        String name = source.getPackageName();
         if (name.startsWith(Modules.INTERNAL_CLASSNAME_PREFIX)) {
             // Remove the "internal" part from Apache SIS package names.
             name = Modules.CLASSNAME_PREFIX + 
name.substring(Modules.INTERNAL_CLASSNAME_PREFIX.length());
diff --git 
a/core/sis-utility/src/test/java/org/apache/sis/test/ProjectDirectories.java 
b/core/sis-utility/src/test/java/org/apache/sis/test/ProjectDirectories.java
index edcfbcd7ee..ea3e14b4bd 100644
--- a/core/sis-utility/src/test/java/org/apache/sis/test/ProjectDirectories.java
+++ b/core/sis-utility/src/test/java/org/apache/sis/test/ProjectDirectories.java
@@ -22,7 +22,6 @@ import java.net.URISyntaxException;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
-import org.apache.sis.internal.jdk9.JDK9;
 
 import static org.junit.Assert.*;
 
@@ -76,7 +75,7 @@ public final class ProjectDirectories {
             throw new AssertionError(e);
         }
         classesPackageDirectory = dir;
-        packageName = JDK9.getPackageName(c);
+        packageName = c.getPackageName();
         String pkg = packageName;
         int s = pkg.length();
         do {
diff --git 
a/storage/sis-geotiff/src/main/java/org/apache/sis/internal/storage/inflater/CompressionChannel.java
 
b/storage/sis-geotiff/src/main/java/org/apache/sis/internal/storage/inflater/CompressionChannel.java
index 0cf98be80a..48c2a936bd 100644
--- 
a/storage/sis-geotiff/src/main/java/org/apache/sis/internal/storage/inflater/CompressionChannel.java
+++ 
b/storage/sis-geotiff/src/main/java/org/apache/sis/internal/storage/inflater/CompressionChannel.java
@@ -117,8 +117,7 @@ abstract class CompressionChannel extends PixelChannel {
         } else {
             capacity = Numerics.ceilDiv(BUFFER_SIZE, scanlineStride) * 
scanlineStride;      // ≥ BUFFER_SIZE
         }
-        // TODO: remove cast with JDK9.
-        final ByteBuffer buffer = (ByteBuffer) 
ByteBuffer.allocate(capacity).order(input.buffer.order()).limit(0);
+        final ByteBuffer buffer = 
ByteBuffer.allocate(capacity).order(input.buffer.order()).limit(0);
         return new ChannelDataInput(input.filename, channel, buffer, true);
     }
 
diff --git 
a/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/CompressedSubset.java
 
b/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/CompressedSubset.java
index 2566aac94e..da4c249afe 100644
--- 
a/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/CompressedSubset.java
+++ 
b/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/CompressedSubset.java
@@ -28,7 +28,7 @@ import org.apache.sis.storage.DataStoreException;
 import org.apache.sis.image.DataType;
 
 import static java.lang.Math.toIntExact;
-import static org.apache.sis.internal.jdk9.JDK9.multiplyFull;
+import static java.lang.Math.multiplyFull;
 
 
 /**
diff --git 
a/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/DataSubset.java
 
b/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/DataSubset.java
index 7a6c9659bb..c885ac88cc 100644
--- 
a/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/DataSubset.java
+++ 
b/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/DataSubset.java
@@ -45,7 +45,7 @@ import org.apache.sis.math.Vector;
 import static java.lang.Math.addExact;
 import static java.lang.Math.subtractExact;
 import static java.lang.Math.multiplyExact;
-import static org.apache.sis.internal.jdk9.JDK9.multiplyFull;
+import static java.lang.Math.multiplyFull;
 import static org.apache.sis.internal.util.Numerics.ceilDiv;
 import static java.lang.Math.toIntExact;
 
diff --git 
a/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/ReversedBitsChannel.java
 
b/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/ReversedBitsChannel.java
index 5258289181..890d82ff2b 100644
--- 
a/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/ReversedBitsChannel.java
+++ 
b/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/ReversedBitsChannel.java
@@ -68,7 +68,7 @@ final class ReversedBitsChannel implements 
ReadableByteChannel, SeekableByteChan
     static ChannelDataInput wrap(final ChannelDataInput input) throws 
IOException {
         final ChannelDataInput output = new ChannelDataInput(
                 input.filename, new ReversedBitsChannel(input),
-                (ByteBuffer) 
ByteBuffer.allocate(2048).order(input.buffer.order()).limit(0), true);     // 
TODO! remove cast widh JDK9.
+                
ByteBuffer.allocate(2048).order(input.buffer.order()).limit(0), true);
         output.setStreamPosition(input.getStreamPosition());
         return output;
     }
diff --git 
a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/RasterResource.java
 
b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/RasterResource.java
index 3c588ae4a5..5aeec3d323 100644
--- 
a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/RasterResource.java
+++ 
b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/RasterResource.java
@@ -54,7 +54,6 @@ import org.apache.sis.util.Numbers;
 import org.apache.sis.util.CharSequences;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.resources.Vocabulary;
-import org.apache.sis.internal.jdk9.JDK9;
 import org.apache.sis.internal.storage.MetadataBuilder;
 import org.apache.sis.internal.storage.RangeArgument;
 import org.apache.sis.internal.storage.StoreResource;
@@ -706,7 +705,7 @@ public final class RasterResource extends 
AbstractGridCoverageResource implement
                 sampleValues = new Buffer[bands.length];
                 for (int i=0; i<sampleValues.length; i++) {
                     if (i != 0) {
-                        values = JDK9.duplicate(values);
+                        values = values.duplicate();
                         final int p = values.limit();
                         values.position(p).limit(Math.addExact(p, stride));
                     }
diff --git 
a/storage/sis-sqlstore/src/main/java/org/apache/sis/internal/sql/postgis/RasterReader.java
 
b/storage/sis-sqlstore/src/main/java/org/apache/sis/internal/sql/postgis/RasterReader.java
index 3610640ecd..79fb6620f7 100644
--- 
a/storage/sis-sqlstore/src/main/java/org/apache/sis/internal/sql/postgis/RasterReader.java
+++ 
b/storage/sis-sqlstore/src/main/java/org/apache/sis/internal/sql/postgis/RasterReader.java
@@ -50,7 +50,6 @@ import org.apache.sis.internal.storage.io.ChannelDataInput;
 import org.apache.sis.internal.sql.feature.InfoStatements;
 import org.apache.sis.internal.util.Constants;
 import org.apache.sis.internal.util.Numerics;
-import org.apache.sis.internal.jdk9.JDK9;
 import org.apache.sis.measure.NumberRange;
 import org.apache.sis.referencing.CRS;
 import org.apache.sis.math.Vector;
@@ -239,7 +238,7 @@ public final class RasterReader extends RasterFormat {
                  */
                 final int sampleSize  = band.getDataTypeSize();                
 // In bits: 1, 2, 4, 8, 16, 32 or 64.
                 final int elementSize = DataBuffer.getDataTypeSize(dataType);  
 // Same as above except for 1, 2, 4.
-                final int length = 
Math.toIntExact(Numerics.ceilDiv(JDK9.multiplyFull(width, height) * sampleSize, 
elementSize));
+                final int length = 
Math.toIntExact(Numerics.ceilDiv(Math.multiplyFull(width, height) * sampleSize, 
elementSize));
                 final Object data;
                 switch (dataType & ~OPPOSITE_SIGN) {
                     case DataBuffer.TYPE_USHORT:
diff --git 
a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/TiledGridCoverage.java
 
b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/TiledGridCoverage.java
index 0f8886dfb8..6139640d22 100644
--- 
a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/TiledGridCoverage.java
+++ 
b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/TiledGridCoverage.java
@@ -42,12 +42,12 @@ import org.apache.sis.util.resources.Errors;
 import static java.lang.Math.addExact;
 import static java.lang.Math.subtractExact;
 import static java.lang.Math.multiplyExact;
+import static java.lang.Math.multiplyFull;
 import static java.lang.Math.incrementExact;
 import static java.lang.Math.decrementExact;
 import static java.lang.Math.toIntExact;
 import static java.lang.Math.floorDiv;
 import static org.apache.sis.internal.util.Numerics.ceilDiv;
-import static org.apache.sis.internal.jdk9.JDK9.multiplyFull;
 
 
 /**
diff --git 
a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/esri/RawRasterReader.java
 
b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/esri/RawRasterReader.java
index 34df0ceeda..b2d0e07475 100644
--- 
a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/esri/RawRasterReader.java
+++ 
b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/esri/RawRasterReader.java
@@ -41,10 +41,10 @@ import org.apache.sis.util.ArraysExt;
 import static java.lang.Math.floorDiv;
 import static java.lang.Math.addExact;
 import static java.lang.Math.multiplyExact;
+import static java.lang.Math.multiplyFull;
 import static java.lang.Math.incrementExact;
 import static org.apache.sis.internal.util.Numerics.ceilDiv;
 import static org.apache.sis.internal.util.Numerics.wholeDiv;
-import static org.apache.sis.internal.jdk9.JDK9.multiplyFull;
 
 
 /**
diff --git 
a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ByteWriter.java
 
b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ByteWriter.java
index d0124cb7f2..ffa41c3963 100644
--- 
a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ByteWriter.java
+++ 
b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ByteWriter.java
@@ -25,7 +25,6 @@ import java.nio.IntBuffer;
 import java.nio.LongBuffer;
 import java.nio.ShortBuffer;
 import org.apache.sis.math.Vector;
-import org.apache.sis.internal.jdk9.JDK9;
 
 
 /**
@@ -35,7 +34,7 @@ import org.apache.sis.internal.jdk9.JDK9;
  * can be invoked in a loop until all data have been transferred.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 1.0
+ * @version 1.4
  * @since   1.0
  * @module
  */
@@ -72,7 +71,7 @@ public abstract class ByteWriter {
      */
     public static ByteWriter create(Buffer source, final ByteBuffer target) {
         if (source.limit() != source.capacity()) {
-            source = JDK9.slice(source);
+            source = source.slice();
         }
         if (source instanceof DoubleBuffer) return new Doubles ((DoubleBuffer) 
source, target);
         if (source instanceof  FloatBuffer) return new Floats  ( (FloatBuffer) 
source, target);
diff --git 
a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/FirstKeywordPeek.java
 
b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/FirstKeywordPeek.java
index 6409ca8a0e..3d33518b65 100644
--- 
a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/FirstKeywordPeek.java
+++ 
b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/FirstKeywordPeek.java
@@ -198,7 +198,7 @@ public abstract class FirstKeywordPeek {
                 do n = channel.read(buffer);
                 while (n >= 0 && buffer.hasRemaining());
             }
-            return probeContent((ByteBuffer) buffer.flip().mark(), null);      
  // TODO: remove cast in JDK9.
+            return probeContent(buffer.flip().mark(), null);
         } catch (IOException e) {
             throw new DataStoreException(e);
         }
diff --git 
a/storage/sis-storage/src/main/java/org/apache/sis/storage/AbstractGridCoverageResource.java
 
b/storage/sis-storage/src/main/java/org/apache/sis/storage/AbstractGridCoverageResource.java
index 7dfa30e160..eaff3f97f2 100644
--- 
a/storage/sis-storage/src/main/java/org/apache/sis/storage/AbstractGridCoverageResource.java
+++ 
b/storage/sis-storage/src/main/java/org/apache/sis/storage/AbstractGridCoverageResource.java
@@ -38,7 +38,6 @@ import org.apache.sis.measure.AngleFormat;
 import org.apache.sis.util.logging.PerformanceLevel;
 import org.apache.sis.internal.storage.io.IOUtilities;
 import org.apache.sis.internal.util.StandardDateFormat;
-import org.apache.sis.internal.jdk9.JDK9;
 import org.apache.sis.internal.storage.MetadataBuilder;
 import org.apache.sis.internal.storage.Resources;
 
@@ -198,7 +197,7 @@ public abstract class AbstractGridCoverageResource extends 
AbstractResource impl
             final Object[] parameters = new Object[6];
             parameters[0] = IOUtilities.filename(file != null ? file : 
listeners.getSourceName());
             parameters[5] = nanos / (double) 
StandardDateFormat.NANOS_PER_SECOND;
-            JDK9.ifPresentOrElse(domain.getGeographicExtent(), (box) -> {
+            domain.getGeographicExtent().ifPresentOrElse((box) -> {
                 final AngleFormat f = new AngleFormat(locale);
                 double min = box.getSouthBoundLatitude();
                 double max = box.getNorthBoundLatitude();
diff --git 
a/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/UpdaterTest.java
 
b/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/UpdaterTest.java
index 8f2fc1b77e..9f5ce3d2dc 100644
--- 
a/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/UpdaterTest.java
+++ 
b/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/UpdaterTest.java
@@ -175,7 +175,7 @@ public final strictfp class UpdaterTest extends TestCase {
      * Also checks some invariants such as the presence of metadata.
      */
     private boolean containsLat20() throws IOException {
-        final String xml = org.apache.sis.internal.jdk9.JDK9.readString(file);
+        final String xml = Files.readString(file);
         assertTrue(xml.contains("<bounds "));       // Sentinel value for 
presence of metadata.
         return xml.contains("lat=\"20");            // May have trailing ".0".
     }


Reply via email to