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 58cd2d406c5703fc029b0ad402bdbec30401e662
Author: Martin Desruisseaux <[email protected]>
AuthorDate: Wed May 11 18:06:36 2022 +0200

    Remove deprecated methods that do not override an abstract methods.
---
 .../apache/sis/gui/coverage/CoverageCanvas.java    | 59 ++++------------------
 .../org/apache/sis/gui/coverage/package-info.java  |  2 +-
 .../java/org/apache/sis/gui/dataset/LoadEvent.java | 47 -----------------
 .../org/apache/sis/gui/dataset/ResourceTree.java   |  2 +-
 .../referencing/provider/Equirectangular.java      |  2 +-
 .../operation/projection/Initializer.java          |  2 +-
 .../operation/transform/ContextualParameters.java  | 28 ++--------
 .../operation/transform/package-info.java          |  2 +-
 .../main/java/org/apache/sis/util/Exceptions.java  | 48 +-----------------
 .../java/org/apache/sis/util/package-info.java     |  2 +-
 10 files changed, 21 insertions(+), 173 deletions(-)

diff --git 
a/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageCanvas.java
 
b/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageCanvas.java
index f76bd19e9a..dbb2663839 100644
--- 
a/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageCanvas.java
+++ 
b/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageCanvas.java
@@ -90,7 +90,7 @@ import static java.util.logging.Logger.getLogger;
  * instance (given by {@link #coverageProperty}) will change automatically 
according the zoom level.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 1.2
+ * @version 1.3
  *
  * @see CoverageExplorer
  *
@@ -161,19 +161,6 @@ public class CoverageCanvas extends MapCanvasAWT {
      */
     private boolean isCoverageAdjusting;
 
-    /**
-     * A subspace of the grid coverage extent where all dimensions except two 
have a size of 1 cell.
-     * May be {@code null} if the grid coverage has only two dimensions with a 
size greater than 1 cell.
-     *
-     * @see #getSliceExtent()
-     * @see #setSliceExtent(GridExtent)
-     * @see GridCoverage#render(GridExtent)
-     *
-     * @deprecated We will need a different mechanism for specifying slice 
dimensions.
-     */
-    @Deprecated
-    public final ObjectProperty<GridExtent> sliceExtentProperty;
-
     /**
      * The interpolation method to use for resampling the image.
      *
@@ -256,11 +243,9 @@ public class CoverageCanvas extends MapCanvasAWT {
         derivedImages         = new EnumMap<>(Stretching.class);
         resourceProperty      = new SimpleObjectProperty<>(this, "resource");
         coverageProperty      = new SimpleObjectProperty<>(this, "coverage");
-        sliceExtentProperty   = new SimpleObjectProperty<>(this, 
"sliceExtent");
         interpolationProperty = new SimpleObjectProperty<>(this, 
"interpolation", data.processor.getInterpolation());
         resourceProperty     .addListener((p,o,n) -> onPropertySpecified(n, 
null, coverageProperty));
         coverageProperty     .addListener((p,o,n) -> onPropertySpecified(null, 
n, resourceProperty));
-        sliceExtentProperty  .addListener((p,o,n) -> 
onPropertySpecified(getResource(), getCoverage(), null));
         interpolationProperty.addListener((p,o,n) -> 
onInterpolationSpecified(n));
     }
 
@@ -374,37 +359,6 @@ public class CoverageCanvas extends MapCanvasAWT {
         }
     }
 
-    /**
-     * Returns a subspace of the grid coverage extent where all dimensions 
except two have a size of 1 cell.
-     *
-     * @return subspace of the grid coverage extent where all dimensions 
except two have a size of 1 cell.
-     *
-     * @see #sliceExtentProperty
-     * @see GridCoverage#render(GridExtent)
-     *
-     * @deprecated We will need a different mechanism for specifying slice 
dimensions.
-     */
-    @Deprecated
-    public final GridExtent getSliceExtent() {
-        return sliceExtentProperty.get();
-    }
-
-    /**
-     * Sets a subspace of the grid coverage extent where all dimensions except 
two have a size of 1 cell.
-     *
-     * @param  sliceExtent  subspace of the grid coverage extent where all 
dimensions except two have a size of 1 cell.
-     *
-     * @see #sliceExtentProperty
-     * @see GridCoverage#render(GridExtent)
-     *
-     * @deprecated We will need a different mechanism for specifying slice 
dimensions.
-     */
-    @Deprecated
-    public final void setSliceExtent(final GridExtent sliceExtent) {
-        sliceExtentProperty.set(sliceExtent);
-        // Will indirectly invoke `onPropertySpecified(…)`.
-    }
-
     /**
      * Gets the interpolation method used during resample operations.
      *
@@ -516,7 +470,7 @@ public class CoverageCanvas extends MapCanvasAWT {
         if (isCoverageAdjusting) {
             return;
         }
-        if (toClear != null) try {
+        try {
             isCoverageAdjusting = true;
             toClear.set(null);
         } finally {
@@ -674,7 +628,13 @@ public class CoverageCanvas extends MapCanvasAWT {
          */
         private boolean coverageChanged;
 
-        @Deprecated private final GridExtent sliceExtent;
+        /**
+         * The two-dimensional slice to display.
+         *
+         * @todo We do not yet have a mechanism for computing it.
+         *       May become a non-static field in a future version.
+         */
+        private static final GridExtent sliceExtent = null;
 
         /**
          * Value of {@link CoverageCanvas#data} at the time this worker has 
been initialized.
@@ -758,7 +718,6 @@ public class CoverageCanvas extends MapCanvasAWT {
             resource           = canvas.getResource();
             coverage           = canvas.getCoverage();
             data               = canvas.data.clone();
-            sliceExtent        = canvas.getSliceExtent();
             objectiveCRS       = canvas.getObjectiveCRS();
             objectiveToDisplay = canvas.getObjectiveToDisplay();
             displayBounds      = canvas.getDisplayBounds();
diff --git 
a/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/package-info.java
 
b/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/package-info.java
index cb2d7309d2..15aaa4ab0c 100644
--- 
a/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/package-info.java
+++ 
b/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/package-info.java
@@ -19,7 +19,7 @@
  * Widgets showing {@link org.apache.sis.coverage.grid.GridCoverage} images or 
sample values.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 1.2
+ * @version 1.3
  * @since   1.1
  * @module
  */
diff --git 
a/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/LoadEvent.java
 
b/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/LoadEvent.java
deleted file mode 100644
index 5b978394a0..0000000000
--- 
a/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/LoadEvent.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.gui.dataset;
-
-import java.nio.file.Path;
-
-
-/**
- * Event sent when a resource is loaded.
- *
- * @author  Martin Desruisseaux (Geomatys)
- * @version 1.2
- * @since   1.1
- *
- * @deprecated Renamed {@link ResourceEvent}.
- */
-@Deprecated
-public final class LoadEvent extends ResourceEvent {
-    /**
-     * For cross-version compatibility.
-     */
-    private static final long serialVersionUID = 5935085957507976585L;
-
-    /**
-     * Creates a new event.
-     *
-     * @param  source  the source of this event.
-     * @param  path    path to the file being loaded.
-     */
-    LoadEvent(final ResourceTree source, final Path path) {
-        super(source, path, LOADED);
-    }
-}
diff --git 
a/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/ResourceTree.java
 
b/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/ResourceTree.java
index 3b0ef263a1..08e22affa6 100644
--- 
a/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/ResourceTree.java
+++ 
b/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/ResourceTree.java
@@ -302,7 +302,7 @@ public class ResourceTree extends TreeView<Resource> {
                 if (added) {
                     ((Item) findOrRemove(store, false)).path = path;
                 }
-                handler.handle(new LoadEvent(this, path));
+                handler.handle(new ResourceEvent(this, path, 
ResourceEvent.LOADED));
             }
         }
     }
diff --git 
a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Equirectangular.java
 
b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Equirectangular.java
index c5169c57ee..aceb60b978 100644
--- 
a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Equirectangular.java
+++ 
b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Equirectangular.java
@@ -334,7 +334,7 @@ public final class Equirectangular extends AbstractProvider 
{
             throws FactoryException
     {
         final Parameters p = Parameters.castOrWrap(parameters);
-        final ContextualParameters context = new ContextualParameters(this);
+        final ContextualParameters context = new 
ContextualParameters(PARAMETERS, 2, 2);
         double a  = getAndStore(p, context, MapProjection.SEMI_MAJOR);
         double b  = getAndStore(p, context, MapProjection.SEMI_MINOR);
         double λ0 = getAndStore(p, context, LONGITUDE_OF_ORIGIN);
diff --git 
a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Initializer.java
 
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Initializer.java
index 63699a5546..b3551e0da6 100644
--- 
a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Initializer.java
+++ 
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Initializer.java
@@ -114,7 +114,7 @@ final class Initializer {
         ensureNonNull("method",     method);
         ensureNonNull("parameters", parameters);
         ensureNonNull("roles",      roles);
-        this.context    = new ContextualParameters(method);
+        this.context    = new ContextualParameters(method.getParameters(), 2, 
2);
         this.parameters = parameters;
         this.variant    = variant;
         /*
diff --git 
a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ContextualParameters.java
 
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ContextualParameters.java
index 55534eb572..1e73e1b522 100644
--- 
a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ContextualParameters.java
+++ 
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ContextualParameters.java
@@ -32,7 +32,6 @@ import org.opengis.parameter.ParameterValueGroup;
 import org.opengis.parameter.ParameterDescriptor;
 import org.opengis.parameter.ParameterDescriptorGroup;
 import org.opengis.parameter.ParameterNotFoundException;
-import org.opengis.referencing.operation.OperationMethod;
 import org.opengis.referencing.operation.Matrix;
 import org.opengis.referencing.operation.MathTransform;
 import org.opengis.referencing.operation.MathTransformFactory;
@@ -125,7 +124,7 @@ import static java.util.logging.Logger.getLogger;
  * Serialization should be used only for short term storage or RMI between 
applications running the same SIS version.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 1.2
+ * @version 1.3
  *
  * @see org.apache.sis.referencing.operation.projection.NormalizedProjection
  * @see AbstractMathTransform#getContextualParameters()
@@ -232,7 +231,7 @@ public class ContextualParameters extends Parameters 
implements Serializable {
     private boolean isFrozen;
 
     /**
-     * Creates a new group of parameters for the given non-linear coordinate 
operation method.
+     * Creates a new group of parameters with the given descriptor.
      * The {@linkplain 
org.apache.sis.referencing.operation.DefaultOperationMethod#getParameters() 
method parameters}
      * shall describe the <cite>normalize</cite> → <cite>non-linear 
kernel</cite> → <cite>denormalize</cite> sequence
      * as a whole. After construction, callers shall:
@@ -248,23 +247,6 @@ public class ContextualParameters extends Parameters 
implements Serializable {
      *
      * See class javadoc for more information.
      *
-     * @param  method  the non-linear operation method for which to define the 
parameter values.
-     *
-     * @deprecated Use the constructor with explicit number of dimensions 
instead.
-     */
-    @Deprecated
-    public ContextualParameters(final OperationMethod method) {
-        ArgumentChecks.ensureNonNull("method", method);
-        descriptor  = method.getParameters();
-        normalize   = linear("sourceDimensions", method.getSourceDimensions());
-        denormalize = linear("targetDimensions", method.getTargetDimensions());
-        values      = new ParameterValue<?>[descriptor.descriptors().size()];
-    }
-
-    /**
-     * Creates a new group of parameters with the given descriptor. This 
constructor performs the same construction than
-     * {@link #ContextualParameters(OperationMethod)} but without the need to 
specify an {@code OperationMethod} instance.
-     *
      * @param  descriptor  the parameter descriptor.
      * @param  srcDim      number of source dimensions.
      * @param  tgtDim      number of target dimensions.
@@ -407,9 +389,9 @@ public class ContextualParameters extends Parameters 
implements Serializable {
 
     /**
      * Returns the affine transforms to be applied before or after the 
non-linear kernel operation.
-     * Immediately after {@linkplain #ContextualParameters(OperationMethod) 
construction}, those matrices
-     * are modifiable identity matrices. Callers can modify the matrix element 
values, typically by calls to
-     * the {@link MatrixSIS#convertBefore(int, Number, Number) 
MatrixSIS.convertBefore(…)} method.
+     * Immediately after {@linkplain 
#ContextualParameters(ParameterDescriptorGroup, int, int) construction},
+     * those matrices are modifiable identity matrices. Callers can modify the 
matrix element values, typically
+     * by calls to the {@link MatrixSIS#convertBefore(int, Number, Number) 
MatrixSIS.convertBefore(…)} method.
      * Alternatively, the following methods can be invoked for applying some 
frequently used configurations:
      *
      * <ul>
diff --git 
a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/package-info.java
 
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/package-info.java
index 5298191e8d..08e117e96e 100644
--- 
a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/package-info.java
+++ 
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/package-info.java
@@ -61,7 +61,7 @@
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @author  Adrian Custer (Geomatys)
- * @version 1.2
+ * @version 1.3
  * @since   0.5
  * @module
  */
diff --git a/core/sis-utility/src/main/java/org/apache/sis/util/Exceptions.java 
b/core/sis-utility/src/main/java/org/apache/sis/util/Exceptions.java
index f16fcbb03e..e38fde2cef 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/util/Exceptions.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/util/Exceptions.java
@@ -34,7 +34,7 @@ import org.apache.sis.util.collection.BackingStoreException;
  * Static methods working with {@link Exception} instances.
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
- * @version 1.1
+ * @version 1.3
  * @since   0.3
  * @module
  */
@@ -89,52 +89,6 @@ public final class Exceptions extends Static {
         return exception.getLocalizedMessage();
     }
 
-    /**
-     * Returns an exception of the same kind and with the same stack trace 
than the given
-     * exception, but with a different message. This method simulates the 
functionality
-     * that we would have if {@link Throwable} defined a {@code 
setMessage(String)} method.
-     * We use this method when an external library throws an exception of the 
right type,
-     * but with too few details.
-     *
-     * <p>This method tries to create a new exception using reflection. The 
exception class needs
-     * to provide a public constructor expecting a single {@link String} 
argument. If the
-     * exception class does not provide such constructor, then the given 
exception is returned
-     * unchanged.</p>
-     *
-     * @param <T>        the type of the exception.
-     * @param exception  the exception to copy with a different message.
-     * @param message    the message to set in the exception to be returned.
-     * @param append     if {@code true}, the existing message in the original 
exception (if any)
-     *                   will be happened after the provided message.
-     * @return a new exception with the given message, or the given exception 
if the exception
-     *         class does not provide public {@code Exception(String)} 
constructor.
-     *
-     * @deprecated To be removed with no replacement.
-     */
-    @Deprecated
-    @SuppressWarnings("unchecked")
-    public static <T extends Throwable> T setMessage(final T exception, String 
message, final boolean append) {
-        if (append) {
-            final String em = 
CharSequences.trimWhitespaces(exception.getLocalizedMessage());
-            if (em != null && !em.isEmpty()) {
-                final StringBuilder buffer = new 
StringBuilder(CharSequences.trimWhitespaces(message));
-                final int length = buffer.length();
-                if (length != 0 && 
Character.isLetterOrDigit(buffer.charAt(length-1))) {
-                    buffer.append(". ");
-                }
-                message = buffer.append(em).toString();
-            }
-        }
-        final Throwable ne;
-        try {
-            ne = 
exception.getClass().getConstructor(String.class).newInstance(message);
-        } catch (ReflectiveOperationException e) {
-            return exception;
-        }
-        ne.setStackTrace(exception.getStackTrace());
-        return (T) ne;
-    }
-
     /**
      * Returns {@code true} if the given exceptions are of the same class and 
contains the same message.
      * This method does not compare the {@linkplain Throwable#getStackTrace() 
stack trace},
diff --git 
a/core/sis-utility/src/main/java/org/apache/sis/util/package-info.java 
b/core/sis-utility/src/main/java/org/apache/sis/util/package-info.java
index 5c6bf92b48..f5c79257b8 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/util/package-info.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/util/package-info.java
@@ -39,7 +39,7 @@
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @author  Alexis Manin (Geomatys)
- * @version 1.2
+ * @version 1.3
  * @since   0.3
  * @module
  */

Reply via email to