You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2026/10/16 23:31:52 UTC
(sis) branch geoapi-4.0 updated (fc44195bc6 -> b05e8580ae)
This is an automated email from the ASF dual-hosted git repository.
asf-gitbox-commits pushed a change to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git
from fc44195bc6 feat(Geometry): implement Polyhedron toPrimitive
new 8f28402709 Documentation: uniformize the reminder about the workaround while waiting for JEP 513.
new 120b6be14d Removed the deprecated `LocalizedException` interface.
new c12db32071 Fix a wrong encoding in logging property files. That particular case is fixed to ISO-LATIN-1.
new 27beef8199 Partial workaround for the problem of HSQL which ignore collations in LIKE clause. We cannot compensate fully this problem, but we can make it less frequent.
new b05e8580ae Upgrade from Java 11 to Java 12. The plan is to upgrade to a higher version, but this small step is done first for testing if there is any user reaction.
The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
README.md | 2 +-
endorsed/build.gradle.kts | 2 +-
.../org/apache/sis/console/IdentifierCommand.java | 5 +-
.../main/org/apache/sis/coverage/Category.java | 3 +-
.../apache/sis/coverage/grid/GridCoverage2D.java | 2 +-
.../sis/coverage/grid/ValuesAtPointIterator.java | 11 ++-
.../org/apache/sis/feature/EnvelopeOperation.java | 8 +-
.../sis/feature/FeatureOperationException.java | 46 +++++-------
.../sis/feature/InvalidFeatureException.java | 38 +++++-----
.../main/org/apache/sis/feature/package-info.java | 2 +-
.../main/org/apache/sis/image/OverviewImage.java | 13 +++-
.../org/apache/sis/image/SourceAlignedImage.java | 8 +-
.../sis/metadata/MetadataVisitorException.java | 52 +++++++++----
.../iso/extent/NotSpatioTemporalException.java | 5 +-
.../sis/metadata/sql/internal/shared/Dialect.java | 11 +++
.../metadata/sql/internal/shared/SQLBuilder.java | 3 +-
.../metadata/sql/internal/shared/ScriptRunner.java | 4 +-
.../sis/metadata/sql/internal/shared/Supports.java | 8 +-
.../main/org/apache/sis/openoffice/CalcAddins.java | 20 +----
.../gazetteer/GeohashReferenceSystem.java | 7 +-
.../gazetteer/MilitaryGridReferenceSystem.java | 18 ++---
.../main/org/apache/sis/geometry/Envelope2D.java | 3 +-
.../sis/io/wkt/UnparsableObjectException.java | 49 +++++++++----
.../main/org/apache/sis/io/wkt/package-info.java | 2 +-
.../sis/parameter/MapProjectionDescriptor.java | 5 +-
.../sis/referencing/crs/DefaultProjectedCRS.java | 5 +-
.../sis/referencing/cs/DefaultCompoundCS.java | 5 +-
.../factory/ConcurrentAuthorityFactory.java | 2 +-
.../factory/IdentifiedObjectFinder.java | 2 +-
.../referencing/factory/sql/EPSGCodeFinder.java | 61 ++++++++++++----
.../sis/referencing/factory/sql/EPSGInstaller.java | 4 +
.../sis/referencing/factory/sql/SQLTranslator.java | 16 +++-
.../sis/referencing/factory/sql/package-info.java | 2 +-
.../operation/DefaultOperationMethod.java | 5 +-
.../operation/DefaultPassThroughOperation.java | 5 +-
.../operation/projection/AlbersEqualArea.java | 13 ++--
.../operation/projection/AzimuthalEquidistant.java | 5 +-
.../operation/projection/CassiniSoldner.java | 5 +-
.../operation/projection/CylindricalEqualArea.java | 13 ++--
.../projection/EquidistantCylindrical.java | 13 ++--
.../projection/LambertAzimuthalEqualArea.java | 13 ++--
.../projection/LambertConicConformal.java | 13 ++--
.../referencing/operation/projection/Mercator.java | 13 ++--
.../projection/ModifiedAzimuthalEquidistant.java | 12 ++-
.../operation/projection/Mollweide.java | 7 +-
.../operation/projection/ObliqueMercator.java | 12 ++-
.../operation/projection/ObliqueStereographic.java | 12 ++-
.../operation/projection/Orthographic.java | 12 ++-
.../operation/projection/PolarStereographic.java | 12 ++-
.../operation/projection/Polyconic.java | 12 ++-
.../referencing/operation/projection/Robinson.java | 7 +-
.../operation/projection/SatelliteTracking.java | 12 ++-
.../operation/projection/Sinusoidal.java | 12 ++-
.../operation/projection/TransverseMercator.java | 7 +-
.../sis/referencing/operation/provider/Affine.java | 5 +-
.../sis/referencing/operation/projection/NoOp.java | 15 ++--
.../transform/ProjectiveTransformTest.java | 5 +-
.../apache/sis/storage/geoheif/ImageResource.java | 2 +-
.../storage/isobmff/base/IdentifiedMediaData.java | 5 +-
.../sis/storage/geoheif/SelfConsistencyTest.java | 5 +-
.../sis/storage/geotiff/SelfConsistencyTest.java | 5 +-
.../sis/storage/netcdf/SelfConsistencyTest.java | 7 +-
.../org/apache/sis/storage/DataStoreException.java | 59 ++++++++++-----
.../sis/storage/UnsupportedStorageException.java | 5 +-
.../sis/storage/internal/InputStreamAdapter.java | 2 +-
.../sis/storage/esri/BILConsistencyTest.java | 10 +--
.../sis/storage/esri/BIPConsistencyTest.java | 10 +--
.../sis/storage/esri/BSQConsistencyTest.java | 10 +--
.../sis/storage/image/SelfConsistencyTest.java | 10 +--
.../sis/storage/test/CoverageReadConsistency.java | 6 +-
.../src/org.apache.sis.util/main/module-info.java | 3 +-
.../main/org/apache/sis/pending/jdk/JDK13.java | 2 +-
.../main/org/apache/sis/pending/jdk/JDK15.java | 2 +-
.../main/org/apache/sis/pending/jdk/JDK16.java | 2 +-
.../main/org/apache/sis/pending/jdk/JDK17.java | 2 +-
.../main/org/apache/sis/pending/jdk/JDK18.java | 2 +-
.../main/org/apache/sis/pending/jdk/JDK19.java | 2 +-
.../main/org/apache/sis/pending/jdk/JDK20.java | 2 +-
.../main/org/apache/sis/pending/jdk/JDK21.java | 2 +-
.../main/org/apache/sis/pending/jdk/JDK22.java | 2 +-
.../main/org/apache/sis/pending/jdk/JDK23.java | 2 +-
.../sis/pending/jdk/{JDK12.java => JDK26.java} | 25 +++----
.../org/apache/sis/pending/jdk/package-info.java | 2 +-
.../main/org/apache/sis/util/Classes.java | 21 +-----
.../main/org/apache/sis/util/Exceptions.java | 44 ++++-------
.../org/apache/sis/util/LocalizedException.java | 85 ----------------------
.../internal/shared/LocalizedParseException.java | 54 +++++++++-----
.../org/apache/sis/util/logging/Initializer.java | 8 +-
.../main/org/apache/sis/util/logging/Logging.java | 4 +-
.../main/org/apache/sis/util/package-info.java | 2 +-
.../sis/util/resources/IndexedResourceBundle.java | 8 +-
.../test/org/apache/sis/test/Printer.java | 5 +-
.../shared/LocalizedParseExceptionTest.java | 12 +--
.../apache/sis/storage/geopackage/GpkgStore.java | 5 +-
.../apache/sis/storage/geopackage/Initializer.java | 5 +-
optional/README.md | 2 +-
optional/src/org.apache.sis.gui/bundle/README | 2 +-
.../org/apache/sis/gui/referencing/WKTPane.java | 7 +-
parent/overview.html | 2 +-
parent/pom.xml | 4 +-
100 files changed, 544 insertions(+), 576 deletions(-)
rename endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/{JDK12.java => JDK26.java} (64%)
delete mode 100644 endorsed/src/org.apache.sis.util/main/org/apache/sis/util/LocalizedException.java
(sis) 01/05: Documentation: uniformize the reminder about the workaround while waiting for JEP 513.
Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
asf-gitbox-commits pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git
commit 8f2840270923b5f8dd0bfa2f4fa20a80c54be954
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Thu Oct 15 18:02:31 2026 +0200
Documentation: uniformize the reminder about the workaround while waiting for JEP 513.
---
.../main/org/apache/sis/console/IdentifierCommand.java | 5 ++---
.../main/org/apache/sis/coverage/Category.java | 3 +--
.../org/apache/sis/coverage/grid/GridCoverage2D.java | 2 +-
.../sis/coverage/grid/ValuesAtPointIterator.java | 11 +++++++----
.../main/org/apache/sis/image/OverviewImage.java | 13 ++++++++++---
.../main/org/apache/sis/image/SourceAlignedImage.java | 8 ++++----
.../iso/extent/NotSpatioTemporalException.java | 5 ++---
.../referencing/gazetteer/GeohashReferenceSystem.java | 7 +++----
.../gazetteer/MilitaryGridReferenceSystem.java | 18 ++++++++----------
.../main/org/apache/sis/geometry/Envelope2D.java | 3 +--
.../apache/sis/parameter/MapProjectionDescriptor.java | 5 ++---
.../sis/referencing/crs/DefaultProjectedCRS.java | 5 ++---
.../apache/sis/referencing/cs/DefaultCompoundCS.java | 5 ++---
.../referencing/operation/DefaultOperationMethod.java | 5 ++---
.../operation/DefaultPassThroughOperation.java | 5 +++--
.../operation/projection/AlbersEqualArea.java | 13 +++++--------
.../operation/projection/AzimuthalEquidistant.java | 5 ++---
.../operation/projection/CassiniSoldner.java | 5 ++---
.../operation/projection/CylindricalEqualArea.java | 13 +++++--------
.../operation/projection/EquidistantCylindrical.java | 13 +++++--------
.../projection/LambertAzimuthalEqualArea.java | 13 +++++--------
.../operation/projection/LambertConicConformal.java | 13 +++++--------
.../sis/referencing/operation/projection/Mercator.java | 13 +++++--------
.../projection/ModifiedAzimuthalEquidistant.java | 12 +++++-------
.../referencing/operation/projection/Mollweide.java | 7 +++----
.../operation/projection/ObliqueMercator.java | 12 +++++-------
.../operation/projection/ObliqueStereographic.java | 12 +++++-------
.../referencing/operation/projection/Orthographic.java | 12 +++++-------
.../operation/projection/PolarStereographic.java | 12 +++++-------
.../referencing/operation/projection/Polyconic.java | 12 +++++-------
.../sis/referencing/operation/projection/Robinson.java | 7 +++----
.../operation/projection/SatelliteTracking.java | 12 +++++-------
.../referencing/operation/projection/Sinusoidal.java | 12 +++++-------
.../operation/projection/TransverseMercator.java | 7 +++----
.../sis/referencing/operation/provider/Affine.java | 5 ++---
.../sis/referencing/operation/projection/NoOp.java | 15 ++++++---------
.../operation/transform/ProjectiveTransformTest.java | 5 ++++-
.../sis/storage/isobmff/base/IdentifiedMediaData.java | 5 ++---
.../sis/storage/geoheif/SelfConsistencyTest.java | 5 +++--
.../sis/storage/geotiff/SelfConsistencyTest.java | 5 +++--
.../apache/sis/storage/netcdf/SelfConsistencyTest.java | 7 +++++--
.../org/apache/sis/storage/DataStoreException.java | 4 ++--
.../sis/storage/UnsupportedStorageException.java | 5 ++---
.../apache/sis/storage/esri/BILConsistencyTest.java | 10 ++++------
.../apache/sis/storage/esri/BIPConsistencyTest.java | 10 ++++------
.../apache/sis/storage/esri/BSQConsistencyTest.java | 10 ++++------
.../apache/sis/storage/image/SelfConsistencyTest.java | 10 ++++------
.../sis/storage/test/CoverageReadConsistency.java | 6 ++----
.../util/internal/shared/LocalizedParseException.java | 16 ++++++++--------
.../test/org/apache/sis/test/Printer.java | 5 ++---
.../org/apache/sis/storage/geopackage/GpkgStore.java | 5 ++---
.../org/apache/sis/storage/geopackage/Initializer.java | 5 ++---
52 files changed, 194 insertions(+), 244 deletions(-)
diff --git a/endorsed/src/org.apache.sis.console/main/org/apache/sis/console/IdentifierCommand.java b/endorsed/src/org.apache.sis.console/main/org/apache/sis/console/IdentifierCommand.java
index b4c69abf1e..7c52f8eac1 100644
--- a/endorsed/src/org.apache.sis.console/main/org/apache/sis/console/IdentifierCommand.java
+++ b/endorsed/src/org.apache.sis.console/main/org/apache/sis/console/IdentifierCommand.java
@@ -90,10 +90,9 @@ final class IdentifierCommand extends FormattedOutputCommand {
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="7", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private static EnumSet<Option> options() {
final EnumSet<Option> options = MetadataCommand.options();
options.remove(Option.TIMEZONE);
diff --git a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/Category.java b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/Category.java
index 1757c17de8..e3e9bd74c9 100644
--- a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/Category.java
+++ b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/Category.java
@@ -311,8 +311,7 @@ public class Category implements LenientComparable, Serializable {
* minimum and maximum. For linear and logarithmic functions, minimum and maximum are always at
* the bounding input values, so we are using a very simple algorithm for now.
*
- * Note: we could move this code in ConvertedRange constructor if RFE #4093999
- * ("Relax constraint on placement of this()/super() call in constructors") was fixed.
+ * Note: we can move this code in ConvertedRange constructor after upgrade to JDK25.
*/
final NumberRange<?> r = original.range;
boolean minIncluded = r.isMinIncluded();
diff --git a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/GridCoverage2D.java b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/GridCoverage2D.java
index 2b16babc7a..1c4ac07f85 100644
--- a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/GridCoverage2D.java
+++ b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/GridCoverage2D.java
@@ -237,7 +237,7 @@ public class GridCoverage2D extends GridCoverage {
public GridCoverage2D(GridGeometry domain, final List<? extends SampleDimension> range, RenderedImage data) {
/*
* The complex nesting of method calls below is a workaround
- * while waiting for JEP 447: Statements before super(…).
+ * while waiting for JEP 513: Flexible Constuctor Bodies.
*/
super(domain = addExtentIfAbsent(domain, data = unwrapIfSameSize(data)),
defaultIfAbsent(range, data, ImageUtilities.getNumBands(data)));
diff --git a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/ValuesAtPointIterator.java b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/ValuesAtPointIterator.java
index 17ebe40537..ad04d73a05 100644
--- a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/ValuesAtPointIterator.java
+++ b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/ValuesAtPointIterator.java
@@ -23,6 +23,7 @@ import java.util.function.Consumer;
import java.util.function.IntFunction;
import java.awt.image.Raster;
import java.awt.image.RenderedImage;
+import org.apache.sis.util.Workaround;
import org.apache.sis.util.internal.shared.Strings;
import static org.apache.sis.coverage.grid.GridCoverage.BIDIMENSIONAL;
@@ -382,8 +383,9 @@ abstract class ValuesAtPointIterator implements Spliterator<double[]> {
}
/**
- * Workaround for RFE #4093999 ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
+ @Workaround(library="JDK", version="11", fixed="25")
private Slices(final GridCoverage coverage,
final long[] nearestXY,
final int limitOfXY,
@@ -403,7 +405,7 @@ abstract class ValuesAtPointIterator implements Spliterator<double[]> {
* of applying the inverse of the "grid to CRS" transform on user supplied "real world" coordinates,
* then resolving wraparounds. This constructor rounds these grid coordinates to nearest integers.
*
- * @todo Retrofit in above constructor after RFE #4093999.
+ * @todo Retrofit in above constructor after upgrade to JDK25.
*
* @param coverage the coverage which will be evaluated.
* @param gridCoords the grid coordinates as floating-point numbers.
@@ -582,8 +584,9 @@ changeOfSlice: while (numPoints != 0) {
}
/**
- * Workaround for RFE #4093999 ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
+ @Workaround(library="JDK", version="11", fixed="25")
private Image(final RenderedImage image,
final long[] nearestXY,
final int limitOfXY,
@@ -603,7 +606,7 @@ changeOfSlice: while (numPoints != 0) {
/**
* Creates a new iterator for the specified image.
*
- * @todo Retrofit in above constructor after RFE #4093999.
+ * @todo Retrofit in above constructor after upgrade to JDK25.
*
* @param parent the parent iterator from which to inherit the grid coordinates.
* @param limitOfXY index after the last coordinate of the last point to evaluate.
diff --git a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/image/OverviewImage.java b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/image/OverviewImage.java
index 1c381c7e96..83d2063690 100644
--- a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/image/OverviewImage.java
+++ b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/image/OverviewImage.java
@@ -24,6 +24,7 @@ import java.awt.image.RenderedImage;
import java.awt.image.ImagingOpException;
import org.apache.sis.feature.internal.Resources;
import org.apache.sis.util.Disposable;
+import org.apache.sis.util.Workaround;
import org.apache.sis.util.internal.shared.Numerics;
import org.apache.sis.image.internal.shared.ImageUtilities;
@@ -69,7 +70,10 @@ final class OverviewImage extends ComputedImage {
this(targetBounds(ImageUtilities.getBounds(source)), source);
}
- /** Workaround for RFE #4093999 ("Relax constraint on placement of this()/super() call in constructors"). */
+ /**
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
+ */
+ @Workaround(library="JDK", version="11", fixed="25")
private static Rectangle targetBounds(final Rectangle bounds) {
bounds.x >>= 1; // Round toward negative infinity.
bounds.y >>= 1;
@@ -78,10 +82,13 @@ final class OverviewImage extends ComputedImage {
return bounds;
}
- /** Workaround for RFE #4093999 ("Relax constraint on placement of this()/super() call in constructors"). */
+ /**
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
+ */
+ @Workaround(library="JDK", version="11", fixed="25")
private OverviewImage(final Rectangle bounds, final RenderedImage source) {
super(ImageLayout.DEFAULT.createCompatibleSampleModel(source, bounds), source);
- offsetX = (byte) (source.getMinX() & 1); // TODO: move before `targetBounds(…)` after RFE #4093999.
+ offsetX = (byte) (source.getMinX() & 1); // TODO: move before `targetBounds(…)` on JDK25.
offsetY = (byte) (source.getMinY() & 1);
minX = bounds.x;
minY = bounds.y;
diff --git a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/image/SourceAlignedImage.java b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/image/SourceAlignedImage.java
index 21265e35e1..7d215a7886 100644
--- a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/image/SourceAlignedImage.java
+++ b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/image/SourceAlignedImage.java
@@ -79,9 +79,9 @@ abstract class SourceAlignedImage extends ComputedImage {
/**
* Gets the sample model, making sure it has the right size.
- * This is a workaround while waiting for JEP 447: Statements before super(…).
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="1.8")
+ @Workaround(library="JDK", version="11", fixed="25")
private static SampleModel getSampleModel(final RenderedImage source) {
final SampleModel sm = source.getSampleModel();
final int width = source.getTileWidth();
@@ -123,9 +123,9 @@ abstract class SourceAlignedImage extends ComputedImage {
/**
* Creates the sample model.
- * This is a workaround while waiting for JEP 447: Statements before super(…).
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="1.8")
+ @Workaround(library="JDK", version="11", fixed="25")
private static SampleModel createSampleModel(final ColorModel colorModel, final SampleModel original) {
final SampleModel sm = colorModel.createCompatibleSampleModel(original.getWidth(), original.getHeight());
return original.equals(sm) ? original : sm;
diff --git a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/extent/NotSpatioTemporalException.java b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/extent/NotSpatioTemporalException.java
index 229117c07e..5de00fad26 100644
--- a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/extent/NotSpatioTemporalException.java
+++ b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/extent/NotSpatioTemporalException.java
@@ -75,10 +75,9 @@ public class NotSpatioTemporalException extends TransformException {
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="7", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private static String message(final int type, final CoordinateReferenceSystem crs) {
return (crs != null) ? Resources.format(Resources.Keys.MissingDimension_2, type, crs.getName())
: Errors.format(Errors.Keys.UnspecifiedCRS);
diff --git a/endorsed/src/org.apache.sis.referencing.gazetteer/main/org/apache/sis/referencing/gazetteer/GeohashReferenceSystem.java b/endorsed/src/org.apache.sis.referencing.gazetteer/main/org/apache/sis/referencing/gazetteer/GeohashReferenceSystem.java
index 5d8f4569c9..85437b2411 100644
--- a/endorsed/src/org.apache.sis.referencing.gazetteer/main/org/apache/sis/referencing/gazetteer/GeohashReferenceSystem.java
+++ b/endorsed/src/org.apache.sis.referencing.gazetteer/main/org/apache/sis/referencing/gazetteer/GeohashReferenceSystem.java
@@ -194,12 +194,11 @@ public class GeohashReferenceSystem extends ReferencingByIdentifiers {
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="8", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private static LocationType[] types() {
- final ModifiableLocationType gzd = new ModifiableLocationType(IDENTIFIER);
+ final var gzd = new ModifiableLocationType(IDENTIFIER);
gzd.addIdentification(Vocabulary.formatInternational(Vocabulary.Keys.Code));
return new LocationType[] {gzd};
}
diff --git a/endorsed/src/org.apache.sis.referencing.gazetteer/main/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java b/endorsed/src/org.apache.sis.referencing.gazetteer/main/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java
index b830018494..3acbfb6109 100644
--- a/endorsed/src/org.apache.sis.referencing.gazetteer/main/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java
+++ b/endorsed/src/org.apache.sis.referencing.gazetteer/main/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java
@@ -289,10 +289,9 @@ public class MilitaryGridReferenceSystem extends ReferencingByIdentifiers {
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="8", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private static Map<String,?> properties() {
Party party;
try {
@@ -306,14 +305,13 @@ public class MilitaryGridReferenceSystem extends ReferencingByIdentifiers {
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="8", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private static LocationType[] types() {
- final ModifiableLocationType gzd = new ModifiableLocationType(Resources.formatInternational(Resources.Keys.GridZoneDesignator));
- final ModifiableLocationType square = new ModifiableLocationType(Resources.formatInternational(Resources.Keys.SquareIdentifier100));
- final ModifiableLocationType coord = new ModifiableLocationType(Resources.formatInternational(Resources.Keys.GridCoordinates));
+ final var gzd = new ModifiableLocationType(Resources.formatInternational(Resources.Keys.GridZoneDesignator));
+ final var square = new ModifiableLocationType(Resources.formatInternational(Resources.Keys.SquareIdentifier100));
+ final var coord = new ModifiableLocationType(Resources.formatInternational(Resources.Keys.GridCoordinates));
gzd .addIdentification(Vocabulary.formatInternational(Vocabulary.Keys.Code));
coord .addIdentification(Vocabulary.formatInternational(Vocabulary.Keys.Coordinate));
square.addParent(gzd);
@@ -332,7 +330,7 @@ public class MilitaryGridReferenceSystem extends ReferencingByIdentifiers {
// No need to synchronized; not a big deal if computed twice.
short origin = south ? southOffset : northOffset;
if (origin == 0) {
- final DirectPosition2D position = new DirectPosition2D(
+ final var position = new DirectPosition2D(
south ? TransverseMercator.Zoner.SOUTH_BOUNDS
: TransverseMercator.Zoner.NORTH_BOUNDS, 0);
double northing = datum.universal(position.x * 1.01, position.y).getConversionFromBase()
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/geometry/Envelope2D.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/geometry/Envelope2D.java
index 569f5ba933..02f22c2841 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/geometry/Envelope2D.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/geometry/Envelope2D.java
@@ -154,8 +154,7 @@ public class Envelope2D extends Rectangle2D.Double implements Envelope, Emptiabl
final DirectPosition upperCorner)
{
/*
- * JDK constraint: The call to ensureDimensionMatch(…) should have been first if Sun/Oracle
- * fixed RFE #4093999 (Relax constraint on placement of this()/super() call in constructors).
+ * JDK constraint: The call to ensureDimensionMatch(…) should be first after upgrade to JDK25.
*/
this(lowerCorner.getCoordinate(0), lowerCorner.getCoordinate(1),
upperCorner.getCoordinate(0), upperCorner.getCoordinate(1));
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/parameter/MapProjectionDescriptor.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/parameter/MapProjectionDescriptor.java
index 02b5a315ac..22bd377cd2 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/parameter/MapProjectionDescriptor.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/parameter/MapProjectionDescriptor.java
@@ -88,10 +88,9 @@ final class MapProjectionDescriptor extends DefaultParameterDescriptorGroup {
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="7", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private static ParameterDescriptor<?>[] addAxisLengths(final ParameterDescriptor<?>[] parameters) {
final ParameterDescriptor<?>[] ext = new ParameterDescriptor<?>[parameters.length + 2];
ext[0] = MapProjection.SEMI_MAJOR;
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/crs/DefaultProjectedCRS.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/crs/DefaultProjectedCRS.java
index 7e3209d2d1..29262daf14 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/crs/DefaultProjectedCRS.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/crs/DefaultProjectedCRS.java
@@ -141,10 +141,9 @@ public class DefaultProjectedCRS extends AbstractDerivedCRS implements Projected
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="7", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private static GeodeticCRS checkDimensions(final GeodeticCRS baseCRS, final CartesianCS derivedCS) {
int n = baseCRS.getCoordinateSystem().getDimension();
if (derivedCS != null) {
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/DefaultCompoundCS.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/DefaultCompoundCS.java
index 5d08069852..3d299759e3 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/DefaultCompoundCS.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/DefaultCompoundCS.java
@@ -124,12 +124,11 @@ public class DefaultCompoundCS extends AbstractCS {
}
/**
- * This is a work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*
* @param components the coordinate systems.
*/
- @Workaround(library="JDK", version="7", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private DefaultCompoundCS(final CoordinateSystem[] components, final CoordinateSystemAxis[] axes) {
super(Map.of(NAME_KEY, AxisDirections.appendTo(new StringBuilder(60).append("Compound CS"), axes)), axes);
this.components = List.of(components);
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultOperationMethod.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultOperationMethod.java
index f07ecb87e9..a517fd61c5 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultOperationMethod.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultOperationMethod.java
@@ -241,10 +241,9 @@ public class DefaultOperationMethod extends AbstractIdentifiedObject implements
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="7", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private static Map<String,?> getProperties(final MathTransform transform) {
ArgumentChecks.ensureNonNull("transform", transform);
if (transform instanceof Parameterized) {
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultPassThroughOperation.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultPassThroughOperation.java
index 2320808efa..d99c28df7d 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultPassThroughOperation.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultPassThroughOperation.java
@@ -36,6 +36,7 @@ import org.apache.sis.referencing.operation.transform.MathTransforms;
import org.apache.sis.referencing.operation.transform.PassThroughTransform;
import org.apache.sis.metadata.internal.shared.ImplementationHelper;
import org.apache.sis.util.ArraysExt;
+import org.apache.sis.util.Workaround;
import org.apache.sis.util.ComparisonMode;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.io.wkt.FormattableObject;
@@ -124,9 +125,9 @@ public class DefaultPassThroughOperation extends AbstractCoordinateOperation imp
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
+ @Workaround(library="JDK", version="11", fixed="25")
private DefaultPassThroughOperation(final Map<String,?> properties,
final CoordinateReferenceSystem sourceCRS,
final CoordinateReferenceSystem targetCRS,
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/AlbersEqualArea.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/AlbersEqualArea.java
index 4df06a0993..28842bc361 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/AlbersEqualArea.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/AlbersEqualArea.java
@@ -88,13 +88,11 @@ public class AlbersEqualArea extends AuthalicConversion {
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @SuppressWarnings("fallthrough")
- @Workaround(library="JDK", version="7", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private static Initializer initializer(final OperationMethod method, final Parameters parameters) {
- final EnumMap<ParameterRole, ParameterDescriptor<Double>> roles = new EnumMap<>(ParameterRole.class);
+ final var roles = new EnumMap<ParameterRole, ParameterDescriptor<Double>>(ParameterRole.class);
roles.put(ParameterRole.FALSE_EASTING, EASTING_AT_FALSE_ORIGIN);
roles.put(ParameterRole.FALSE_NORTHING, NORTHING_AT_FALSE_ORIGIN);
roles.put(ParameterRole.CENTRAL_MERIDIAN, LONGITUDE_OF_FALSE_ORIGIN);
@@ -102,10 +100,9 @@ public class AlbersEqualArea extends AuthalicConversion {
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="7", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private AlbersEqualArea(final Initializer initializer) {
super(initializer, null);
double φ0 = initializer.getAndStore(LATITUDE_OF_FALSE_ORIGIN);
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/AzimuthalEquidistant.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/AzimuthalEquidistant.java
index 100edba838..babd0a6b8f 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/AzimuthalEquidistant.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/AzimuthalEquidistant.java
@@ -80,10 +80,9 @@ public class AzimuthalEquidistant extends NormalizedProjection {
final double sinφ0, cosφ0;
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="8", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private static Initializer initializer(final OperationMethod method, final Parameters parameters) {
final EnumMap<ParameterRole, ParameterDescriptor<Double>> roles = new EnumMap<>(ParameterRole.class);
roles.put(ParameterRole.LATITUDE_OF_CONFORMAL_SPHERE_RADIUS, LATITUDE_OF_ORIGIN);
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/CassiniSoldner.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/CassiniSoldner.java
index 23770b1fd0..8c8d44266f 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/CassiniSoldner.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/CassiniSoldner.java
@@ -141,10 +141,9 @@ public class CassiniSoldner extends MeridianArcBased {
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="7", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private static Initializer initializer(final OperationMethod method, final Parameters parameters) {
final Variant variant = variant(method, new Variant[] {Variant.HYPERBOLIC}, Variant.DEFAULT);
final EnumMap<ParameterRole, ParameterDescriptor<Double>> roles = new EnumMap<>(ParameterRole.class);
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/CylindricalEqualArea.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/CylindricalEqualArea.java
index 737033915a..92e86e9f0a 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/CylindricalEqualArea.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/CylindricalEqualArea.java
@@ -130,14 +130,12 @@ public class CylindricalEqualArea extends AuthalicConversion {
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @SuppressWarnings("fallthrough")
- @Workaround(library="JDK", version="7", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private static Initializer initializer(final OperationMethod method, final Parameters parameters) {
final Variant variant = variant(method, Variant.values(), Variant.ELLIPSOIDAL);
- final EnumMap<ParameterRole, ParameterDescriptor<Double>> roles = new EnumMap<>(ParameterRole.class);
+ final var roles = new EnumMap<ParameterRole, ParameterDescriptor<Double>>(ParameterRole.class);
/*
* "Longitude of origin" and "scale factor" are intentionally omitted from this map because they will
* be handled in a special way. See comments in Mercator.initializer(…) method for more details.
@@ -150,10 +148,9 @@ public class CylindricalEqualArea extends AuthalicConversion {
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="7", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private CylindricalEqualArea(final Initializer initializer) {
super(initializer, null);
variant = (Variant) initializer.variant;
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/EquidistantCylindrical.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/EquidistantCylindrical.java
index bbe96dbf74..b251b01ee6 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/EquidistantCylindrical.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/EquidistantCylindrical.java
@@ -83,13 +83,11 @@ public class EquidistantCylindrical extends NormalizedProjection {
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @SuppressWarnings("fallthrough")
- @Workaround(library="JDK", version="7", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private static Initializer initializer(final OperationMethod method, final Parameters parameters) {
- final EnumMap<ParameterRole, ParameterDescriptor<Double>> roles = new EnumMap<>(ParameterRole.class);
+ final var roles = new EnumMap<ParameterRole, ParameterDescriptor<Double>>(ParameterRole.class);
roles.put(ParameterRole.FALSE_EASTING, Equirectangular.FALSE_EASTING);
roles.put(ParameterRole.FALSE_NORTHING, Equirectangular.FALSE_NORTHING);
roles.put(ParameterRole.CENTRAL_MERIDIAN, Equirectangular.LONGITUDE_OF_ORIGIN);
@@ -97,10 +95,9 @@ public class EquidistantCylindrical extends NormalizedProjection {
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="7", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private EquidistantCylindrical(final Initializer initializer) {
super(initializer, null);
final double φ1 = toRadians(initializer.getAndStore(Equirectangular.STANDARD_PARALLEL));
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/LambertAzimuthalEqualArea.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/LambertAzimuthalEqualArea.java
index e386699b22..1bed4a2db2 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/LambertAzimuthalEqualArea.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/LambertAzimuthalEqualArea.java
@@ -80,13 +80,11 @@ public class LambertAzimuthalEqualArea extends AuthalicConversion {
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @SuppressWarnings("fallthrough")
- @Workaround(library="JDK", version="7", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private static Initializer initializer(final OperationMethod method, final Parameters parameters) {
- final EnumMap<ParameterRole, ParameterDescriptor<Double>> roles = new EnumMap<>(ParameterRole.class);
+ final var roles = new EnumMap<ParameterRole, ParameterDescriptor<Double>>(ParameterRole.class);
roles.put(ParameterRole.CENTRAL_MERIDIAN, LONGITUDE_OF_ORIGIN);
roles.put(ParameterRole.FALSE_EASTING, FALSE_EASTING);
roles.put(ParameterRole.FALSE_NORTHING, FALSE_NORTHING);
@@ -94,10 +92,9 @@ public class LambertAzimuthalEqualArea extends AuthalicConversion {
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="7", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private LambertAzimuthalEqualArea(final Initializer initializer) {
super(initializer, null);
final double φ0 = toRadians(initializer.getAndStore(LATITUDE_OF_ORIGIN));
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/LambertConicConformal.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/LambertConicConformal.java
index 7bfa5750aa..37b78a4d7e 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/LambertConicConformal.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/LambertConicConformal.java
@@ -180,14 +180,12 @@ public class LambertConicConformal extends ConformalProjection {
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @SuppressWarnings("fallthrough")
- @Workaround(library="JDK", version="7", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private static Initializer initializer(final OperationMethod method, final Parameters parameters) {
final Variant variant = variant(method, Variant.values(), Variant.TWO_PARALLELS);
- final EnumMap<ParameterRole, ParameterDescriptor<Double>> roles = new EnumMap<>(ParameterRole.class);
+ final var roles = new EnumMap<ParameterRole, ParameterDescriptor<Double>>(ParameterRole.class);
/*
* "Scale factor" is not formally a "Lambert Conformal (2SP)" argument, but we accept it
* anyway for all Lambert projections since it may be used in some Well Known Text (WKT).
@@ -227,10 +225,9 @@ public class LambertConicConformal extends ConformalProjection {
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="7", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private LambertConicConformal(final Initializer initializer) {
super(initializer);
final Variant variant = (Variant) initializer.variant;
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/Mercator.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/Mercator.java
index 4884e1a17e..7259120223 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/Mercator.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/Mercator.java
@@ -183,14 +183,12 @@ public class Mercator extends ConformalProjection {
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @SuppressWarnings("fallthrough")
- @Workaround(library="JDK", version="7", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private static Initializer initializer(final OperationMethod method, final Parameters parameters) {
final Variant variant = variant(method, Variant.values(), Variant.TWO_PARALLELS);
- final EnumMap<ParameterRole, ParameterDescriptor<Double>> roles = new EnumMap<>(ParameterRole.class);
+ final var roles = new EnumMap<ParameterRole, ParameterDescriptor<Double>>(ParameterRole.class);
/*
* The "scale factor" is not formally a "Mercator 2SP" argument, but we accept it anyway
* for all Mercator projections because it may be used in some Well Known Text (WKT).
@@ -235,10 +233,9 @@ public class Mercator extends ConformalProjection {
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="7", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private Mercator(final Initializer initializer) {
super(initializer);
variant = (Variant) initializer.variant;
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/ModifiedAzimuthalEquidistant.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/ModifiedAzimuthalEquidistant.java
index 2ec28b7902..8af43684db 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/ModifiedAzimuthalEquidistant.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/ModifiedAzimuthalEquidistant.java
@@ -80,12 +80,11 @@ public class ModifiedAzimuthalEquidistant extends AzimuthalEquidistant {
private final double Bp;
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="8", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private static Initializer initializer(final OperationMethod method, final Parameters parameters) {
- final EnumMap<ParameterRole, ParameterDescriptor<Double>> roles = new EnumMap<>(ParameterRole.class);
+ final var roles = new EnumMap<ParameterRole, ParameterDescriptor<Double>>(ParameterRole.class);
roles.put(ParameterRole.CENTRAL_MERIDIAN, LONGITUDE_OF_ORIGIN);
roles.put(ParameterRole.FALSE_EASTING, FALSE_EASTING);
roles.put(ParameterRole.FALSE_NORTHING, FALSE_NORTHING);
@@ -108,10 +107,9 @@ public class ModifiedAzimuthalEquidistant extends AzimuthalEquidistant {
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="8", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private ModifiedAzimuthalEquidistant(final Initializer initializer) {
super(initializer);
var ν0 = initializer.rν2(sinφ0).sqrt().inverse();
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/Mollweide.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/Mollweide.java
index 9ed01b9ed5..8fb004b3ff 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/Mollweide.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/Mollweide.java
@@ -70,12 +70,11 @@ public class Mollweide extends NormalizedProjection {
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="8", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private static Initializer initializer(final OperationMethod method, final Parameters parameters) {
- final EnumMap<ParameterRole, ParameterDescriptor<Double>> roles = new EnumMap<>(ParameterRole.class);
+ final var roles = new EnumMap<ParameterRole, ParameterDescriptor<Double>>(ParameterRole.class);
roles.put(ParameterRole.CENTRAL_MERIDIAN, CENTRAL_MERIDIAN);
roles.put(ParameterRole.FALSE_EASTING, FALSE_EASTING);
roles.put(ParameterRole.FALSE_NORTHING, FALSE_NORTHING);
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/ObliqueMercator.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/ObliqueMercator.java
index 68009a4470..c419bc23e8 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/ObliqueMercator.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/ObliqueMercator.java
@@ -151,13 +151,12 @@ public class ObliqueMercator extends ConformalProjection {
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="7", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private static Initializer initializer(final OperationMethod method, final Parameters parameters) {
final Variant variant = variant(method, Variant.values(), Variant.DEFAULT);
- final EnumMap<ParameterRole, ParameterDescriptor<Double>> roles = new EnumMap<>(ParameterRole.class);
+ final var roles = new EnumMap<ParameterRole, ParameterDescriptor<Double>>(ParameterRole.class);
// ParameterRole.CENTRAL_MERIDIAN intentionally excluded. It will be handled in the constructor instead.
roles.put(ParameterRole.SCALE_FACTOR, SCALE_FACTOR);
roles.put(ParameterRole.FALSE_EASTING, variant.center ? EASTING_AT_CENTRE : FALSE_EASTING);
@@ -166,10 +165,9 @@ public class ObliqueMercator extends ConformalProjection {
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="7", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private ObliqueMercator(final Initializer initializer) {
super(initializer);
final Variant variant = (Variant) initializer.variant;
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/ObliqueStereographic.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/ObliqueStereographic.java
index 29c65e405f..6766f3c6e8 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/ObliqueStereographic.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/ObliqueStereographic.java
@@ -106,12 +106,11 @@ public class ObliqueStereographic extends NormalizedProjection {
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="7", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private static Initializer initializer(final OperationMethod method, final Parameters parameters) {
- final EnumMap<ParameterRole, ParameterDescriptor<Double>> roles = new EnumMap<>(ParameterRole.class);
+ final var roles = new EnumMap<ParameterRole, ParameterDescriptor<Double>>(ParameterRole.class);
roles.put(ParameterRole.CENTRAL_MERIDIAN, LONGITUDE_OF_ORIGIN);
roles.put(ParameterRole.SCALE_FACTOR, SCALE_FACTOR);
roles.put(ParameterRole.FALSE_EASTING, FALSE_EASTING);
@@ -120,10 +119,9 @@ public class ObliqueStereographic extends NormalizedProjection {
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="7", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private ObliqueStereographic(final Initializer initializer) {
super(initializer, null);
final double φ0 = toRadians(initializer.getAndStore(LATITUDE_OF_ORIGIN));
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/Orthographic.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/Orthographic.java
index 6affdb1dc3..4c52e73cae 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/Orthographic.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/Orthographic.java
@@ -64,12 +64,11 @@ public class Orthographic extends NormalizedProjection {
private final double mℯ2_cosφ0;
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="8", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private static Initializer initializer(final OperationMethod method, final Parameters parameters) {
- final EnumMap<ParameterRole, ParameterDescriptor<Double>> roles = new EnumMap<>(ParameterRole.class);
+ final var roles = new EnumMap<ParameterRole, ParameterDescriptor<Double>>(ParameterRole.class);
roles.put(ParameterRole.CENTRAL_MERIDIAN, LONGITUDE_OF_ORIGIN);
roles.put(ParameterRole.FALSE_EASTING, FALSE_EASTING);
roles.put(ParameterRole.FALSE_NORTHING, FALSE_NORTHING);
@@ -92,10 +91,9 @@ public class Orthographic extends NormalizedProjection {
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="8", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private Orthographic(final Initializer initializer) {
super(initializer, null);
final double φ0 = toRadians(initializer.getAndStore(LATITUDE_OF_ORIGIN));
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/PolarStereographic.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/PolarStereographic.java
index 60da7e68d7..6a9359542b 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/PolarStereographic.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/PolarStereographic.java
@@ -134,13 +134,12 @@ public class PolarStereographic extends ConformalProjection {
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="7", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private static Initializer initializer(final OperationMethod method, final Parameters parameters) {
final Variant variant = variant(method, Variant.values(), Variant.B);
- final EnumMap<ParameterRole, ParameterDescriptor<Double>> roles = new EnumMap<>(ParameterRole.class);
+ final var roles = new EnumMap<ParameterRole, ParameterDescriptor<Double>>(ParameterRole.class);
ParameterDescriptor<Double> falseEasting = PolarStereographicA.FALSE_EASTING;
ParameterDescriptor<Double> falseNorthing = PolarStereographicA.FALSE_NORTHING;
if (variant == Variant.C) {
@@ -157,10 +156,9 @@ public class PolarStereographic extends ConformalProjection {
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="7", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private PolarStereographic(final Initializer initializer) {
super(initializer);
final Variant variant = (Variant) initializer.variant;
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/Polyconic.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/Polyconic.java
index 0c1563940d..113ad38fd9 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/Polyconic.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/Polyconic.java
@@ -86,12 +86,11 @@ public class Polyconic extends MeridianArcBased {
private final double ci2, ci4, ci6;
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="8", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private static Initializer initializer(final OperationMethod method, final Parameters parameters) {
- final EnumMap<ParameterRole, ParameterDescriptor<Double>> roles = new EnumMap<>(ParameterRole.class);
+ final var roles = new EnumMap<ParameterRole, ParameterDescriptor<Double>>(ParameterRole.class);
roles.put(ParameterRole.CENTRAL_MERIDIAN, LONGITUDE_OF_ORIGIN);
roles.put(ParameterRole.FALSE_EASTING, FALSE_EASTING);
roles.put(ParameterRole.FALSE_NORTHING, FALSE_NORTHING);
@@ -114,10 +113,9 @@ public class Polyconic extends MeridianArcBased {
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="8", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private Polyconic(final Initializer initializer) {
super(initializer);
final double φ0 = toRadians(initializer.getAndStore(LATITUDE_OF_ORIGIN));
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/Robinson.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/Robinson.java
index 404a3173c8..332f5bbe30 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/Robinson.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/Robinson.java
@@ -90,12 +90,11 @@ public class Robinson extends NormalizedProjection {
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="8", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private static Initializer initializer(final OperationMethod method, final Parameters parameters) {
- final EnumMap<ParameterRole, ParameterDescriptor<Double>> roles = new EnumMap<>(ParameterRole.class);
+ final var roles = new EnumMap<ParameterRole, ParameterDescriptor<Double>>(ParameterRole.class);
roles.put(ParameterRole.CENTRAL_MERIDIAN, CENTRAL_MERIDIAN);
roles.put(ParameterRole.FALSE_EASTING, FALSE_EASTING);
roles.put(ParameterRole.FALSE_NORTHING, FALSE_NORTHING);
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/SatelliteTracking.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/SatelliteTracking.java
index 1e33245e84..65f5470b69 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/SatelliteTracking.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/SatelliteTracking.java
@@ -98,12 +98,11 @@ public class SatelliteTracking extends NormalizedProjection {
private final boolean isConic;
/**
- * Work around for RFE #4093999 in Sun's bug database ("Relax constraint on
- * placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="8", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
static Initializer initializer(final OperationMethod method, final Parameters parameters) {
- final EnumMap<NormalizedProjection.ParameterRole, ParameterDescriptor<Double>> roles = new EnumMap<>(NormalizedProjection.ParameterRole.class);
+ final var roles = new EnumMap<NormalizedProjection.ParameterRole, ParameterDescriptor<Double>>(NormalizedProjection.ParameterRole.class);
roles.put(NormalizedProjection.ParameterRole.CENTRAL_MERIDIAN, CENTRAL_MERIDIAN);
roles.put(ParameterRole.LATITUDE_OF_CONFORMAL_SPHERE_RADIUS, LATITUDE_OF_ORIGIN);
return new Initializer(method, parameters, roles, null);
@@ -121,10 +120,9 @@ public class SatelliteTracking extends NormalizedProjection {
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="8", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private SatelliteTracking(final Initializer initializer) {
super(initializer, null);
final double φ0 = toRadians(initializer.getAndStore(LATITUDE_OF_ORIGIN));
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/Sinusoidal.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/Sinusoidal.java
index b4e7c35a26..d5720e85b9 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/Sinusoidal.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/Sinusoidal.java
@@ -87,13 +87,12 @@ public class Sinusoidal extends MeridianArcBased {
private final Variant variant;
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="8", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private static Initializer initializer(final OperationMethod method, final Parameters parameters) {
final Variant variant = variant(method, Variant.values(), null);
- final EnumMap<ParameterRole, ParameterDescriptor<Double>> roles = new EnumMap<>(ParameterRole.class);
+ final var roles = new EnumMap<ParameterRole, ParameterDescriptor<Double>>(ParameterRole.class);
roles.put(ParameterRole.CENTRAL_MERIDIAN, CENTRAL_MERIDIAN);
roles.put(ParameterRole.FALSE_EASTING, FALSE_EASTING);
roles.put(ParameterRole.FALSE_NORTHING, FALSE_NORTHING);
@@ -116,10 +115,9 @@ public class Sinusoidal extends MeridianArcBased {
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="7", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private Sinusoidal(final Initializer initializer) {
super(initializer);
variant = (Variant) initializer.variant;
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/TransverseMercator.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/TransverseMercator.java
index fbd23875b0..d92e5f149b 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/TransverseMercator.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/projection/TransverseMercator.java
@@ -198,13 +198,12 @@ public class TransverseMercator extends NormalizedProjection {
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="7", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private static Initializer initializer(final OperationMethod method, final Parameters parameters) {
final Variant variant = variant(method, Variant.values(), null);
- final EnumMap<ParameterRole, ParameterDescriptor<Double>> roles = new EnumMap<>(ParameterRole.class);
+ final var roles = new EnumMap<ParameterRole, ParameterDescriptor<Double>>(ParameterRole.class);
ParameterRole xOffset = ParameterRole.FALSE_EASTING;
ParameterRole yOffset = ParameterRole.FALSE_NORTHING;
if (variant == Variant.SOUTH_ORIENTATED) {
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/Affine.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/Affine.java
index 38078c546b..39bd29f8ec 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/Affine.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/Affine.java
@@ -138,10 +138,9 @@ public final class Affine extends AbstractProvider {
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="7", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private static ParameterDescriptor<?>[] descriptors() {
final var descriptors = MatrixParameters.EPSG.getAllDescriptors(EPSG_DIMENSION, EPSG_DIMENSION + 1);
return new ParameterDescriptor<?>[] {
diff --git a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/projection/NoOp.java b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/projection/NoOp.java
index a2b94ee4e7..56138a5650 100644
--- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/projection/NoOp.java
+++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/projection/NoOp.java
@@ -65,10 +65,9 @@ final class NoOp extends ConformalProjection {
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="7", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private NoOp(final Parameters parameters) {
super(new Initializer(new DefaultOperationMethod(
Map.of(DefaultOperationMethod.NAME_KEY, parameters.getDescriptor().getName()),
@@ -76,10 +75,9 @@ final class NoOp extends ConformalProjection {
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="7", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private static Parameters parameters(final Ellipsoid ellipsoid, final boolean declareIvf) {
final Parameters parameters = parameters(
ellipsoid.getSemiMajorAxis(),
@@ -91,10 +89,9 @@ final class NoOp extends ConformalProjection {
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="7", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private static Parameters parameters(final double semiMajor, final double semiMinor) {
final ParameterValueGroup group = new ParameterBuilder()
.addName("No-operation").createGroupForMapProjection().createValue();
diff --git a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/ProjectiveTransformTest.java b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/ProjectiveTransformTest.java
index b435531bf8..1089b4449e 100644
--- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/ProjectiveTransformTest.java
+++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/ProjectiveTransformTest.java
@@ -28,6 +28,7 @@ import org.apache.sis.referencing.operation.matrix.Matrix2;
import org.apache.sis.referencing.operation.matrix.Matrix4;
import org.apache.sis.referencing.internal.shared.ExtendedPrecisionMatrix;
import org.apache.sis.referencing.operation.provider.Affine;
+import org.apache.sis.util.Workaround;
import org.apache.sis.util.internal.shared.DoubleDouble;
import org.apache.sis.parameter.Parameterized;
import org.apache.sis.math.Fraction;
@@ -58,8 +59,9 @@ import org.opengis.test.referencing.AffineTransformTest;
public class ProjectiveTransformTest extends AffineTransformTest {
/**
* A math transform factory which delegates instantiations to the enclosing test class.
- * This is a workaround while waiting for JEP 447: Statements before super(…).
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
+ @Workaround(library="JDK", version="11", fixed="25")
private static final class Proxy extends MathTransformFactoryBase {
/** The enclosing test class. */
ProjectiveTransformTest test;
@@ -73,6 +75,7 @@ public class ProjectiveTransformTest extends AffineTransformTest {
/**
* Creates a new test suite.
*/
+ @SuppressWarnings("LeakingThisInConstructor")
public ProjectiveTransformTest() {
super(new Proxy());
((Proxy) mtFactory).test = this;
diff --git a/endorsed/src/org.apache.sis.storage.geoheif/main/org/apache/sis/storage/isobmff/base/IdentifiedMediaData.java b/endorsed/src/org.apache.sis.storage.geoheif/main/org/apache/sis/storage/isobmff/base/IdentifiedMediaData.java
index e46da1e246..bdaf811d3c 100644
--- a/endorsed/src/org.apache.sis.storage.geoheif/main/org/apache/sis/storage/isobmff/base/IdentifiedMediaData.java
+++ b/endorsed/src/org.apache.sis.storage.geoheif/main/org/apache/sis/storage/isobmff/base/IdentifiedMediaData.java
@@ -64,11 +64,10 @@ public final class IdentifiedMediaData extends MediaData {
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
* The identifier needs to be read before the call to `super(reader)`.
*/
- @Workaround(library="JDK", version="7", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private IdentifiedMediaData(final Reader reader, final int id) throws IOException {
super(reader);
identifier = id;
diff --git a/endorsed/src/org.apache.sis.storage.geoheif/test/org/apache/sis/storage/geoheif/SelfConsistencyTest.java b/endorsed/src/org.apache.sis.storage.geoheif/test/org/apache/sis/storage/geoheif/SelfConsistencyTest.java
index cbf02d64cb..5303bd62ef 100644
--- a/endorsed/src/org.apache.sis.storage.geoheif/test/org/apache/sis/storage/geoheif/SelfConsistencyTest.java
+++ b/endorsed/src/org.apache.sis.storage.geoheif/test/org/apache/sis/storage/geoheif/SelfConsistencyTest.java
@@ -16,6 +16,7 @@
*/
package org.apache.sis.storage.geoheif;
+import org.apache.sis.util.Workaround;
import org.apache.sis.storage.DataStoreException;
import org.apache.sis.storage.GridCoverageResource;
import org.apache.sis.storage.StorageConnector;
@@ -47,12 +48,12 @@ public final class SelfConsistencyTest extends CoverageReadConsistency<GeoHeifSt
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*
* @throws DataStoreException if an error occurred while reading the file.
*/
@Override
+ @Workaround(library="JDK", version="11", fixed="25")
protected GridCoverageResource resource() throws DataStoreException {
return assertInstanceOf(GridCoverageResource.class, store.components().iterator().next());
}
diff --git a/endorsed/src/org.apache.sis.storage.geotiff/test/org/apache/sis/storage/geotiff/SelfConsistencyTest.java b/endorsed/src/org.apache.sis.storage.geotiff/test/org/apache/sis/storage/geotiff/SelfConsistencyTest.java
index b52720fb64..86c6083868 100644
--- a/endorsed/src/org.apache.sis.storage.geotiff/test/org/apache/sis/storage/geotiff/SelfConsistencyTest.java
+++ b/endorsed/src/org.apache.sis.storage.geotiff/test/org/apache/sis/storage/geotiff/SelfConsistencyTest.java
@@ -18,6 +18,7 @@ package org.apache.sis.storage.geotiff;
import java.util.List;
import org.opengis.util.GenericName;
+import org.apache.sis.util.Workaround;
import org.apache.sis.storage.DataStoreException;
import org.apache.sis.storage.GridCoverageResource;
import org.apache.sis.storage.IllegalNameException;
@@ -53,12 +54,12 @@ public final class SelfConsistencyTest extends CoverageReadConsistency<GeoTiffSt
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*
* @throws DataStoreException if an error occurred while reading the file.
*/
@Override
+ @Workaround(library="JDK", version="11", fixed="25")
protected GridCoverageResource resource() throws DataStoreException {
return store.components().iterator().next();
}
diff --git a/endorsed/src/org.apache.sis.storage.netcdf/test/org/apache/sis/storage/netcdf/SelfConsistencyTest.java b/endorsed/src/org.apache.sis.storage.netcdf/test/org/apache/sis/storage/netcdf/SelfConsistencyTest.java
index 152a263954..6ef8b5322f 100644
--- a/endorsed/src/org.apache.sis.storage.netcdf/test/org/apache/sis/storage/netcdf/SelfConsistencyTest.java
+++ b/endorsed/src/org.apache.sis.storage.netcdf/test/org/apache/sis/storage/netcdf/SelfConsistencyTest.java
@@ -16,6 +16,7 @@
*/
package org.apache.sis.storage.netcdf;
+import org.apache.sis.util.Workaround;
import org.apache.sis.storage.DataStoreException;
import org.apache.sis.storage.GridCoverageResource;
import org.apache.sis.storage.StorageConnector;
@@ -47,10 +48,12 @@ public final class SelfConsistencyTest extends CoverageReadConsistency<NetcdfSto
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
+ *
+ * @throws DataStoreException if an error occurred while reading the file.
*/
@Override
+ @Workaround(library="JDK", version="11", fixed="25")
protected GridCoverageResource resource() throws DataStoreException {
return assertInstanceOf(GridCoverageResource.class, store.components().iterator().next());
}
diff --git a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/DataStoreException.java b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/DataStoreException.java
index fecd731d94..ad301679ed 100644
--- a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/DataStoreException.java
+++ b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/DataStoreException.java
@@ -122,9 +122,9 @@ public class DataStoreException extends Exception implements LocalizedException
}
/**
- * Workaround while waiting for JEP 447: Statements before super(…).
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="1.8")
+ @Workaround(library="JDK", version="11", fixed="25")
private DataStoreException(final Locale locale, final Object[] params) {
this(locale, IOUtilities.errorMessageKey(params), params);
}
diff --git a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/UnsupportedStorageException.java b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/UnsupportedStorageException.java
index e1fbdbda72..9f4258d1e0 100644
--- a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/UnsupportedStorageException.java
+++ b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/UnsupportedStorageException.java
@@ -108,10 +108,9 @@ public class UnsupportedStorageException extends IllegalOpenParameterException {
/**
* Returns the type of the given storage, with a special case for files or paths to directories.
- * This is a work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="10", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private static Object type(final Object storage) {
if ((storage instanceof File && ((File) storage).isDirectory()) ||
(storage instanceof Path && Files.isDirectory((Path) storage)))
diff --git a/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/esri/BILConsistencyTest.java b/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/esri/BILConsistencyTest.java
index 3b51dd7fb4..0188bbd6f4 100644
--- a/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/esri/BILConsistencyTest.java
+++ b/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/esri/BILConsistencyTest.java
@@ -45,10 +45,9 @@ public final class BILConsistencyTest extends CoverageReadConsistency<RawRasterS
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="7", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private static RawRasterStore openFile() throws IOException, DataStoreException {
final URL url = BIPConsistencyTest.class.getResource("BIL.raw");
assertNotNull(url, "Test file not found.");
@@ -56,11 +55,10 @@ public final class BILConsistencyTest extends CoverageReadConsistency<RawRasterS
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
@Override
- @Workaround(library="JDK", version="7", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
protected GridCoverageResource resource() throws DataStoreException {
return store;
}
diff --git a/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/esri/BIPConsistencyTest.java b/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/esri/BIPConsistencyTest.java
index 637f453e30..9b8c7c69ae 100644
--- a/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/esri/BIPConsistencyTest.java
+++ b/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/esri/BIPConsistencyTest.java
@@ -45,10 +45,9 @@ public final class BIPConsistencyTest extends CoverageReadConsistency<RawRasterS
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="7", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private static RawRasterStore openFile() throws IOException, DataStoreException {
final URL url = BIPConsistencyTest.class.getResource("BIP.raw");
assertNotNull(url, "Test file not found.");
@@ -56,11 +55,10 @@ public final class BIPConsistencyTest extends CoverageReadConsistency<RawRasterS
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
@Override
- @Workaround(library="JDK", version="7", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
protected GridCoverageResource resource() throws DataStoreException {
return store;
}
diff --git a/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/esri/BSQConsistencyTest.java b/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/esri/BSQConsistencyTest.java
index 25509b3c6e..03574c40cf 100644
--- a/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/esri/BSQConsistencyTest.java
+++ b/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/esri/BSQConsistencyTest.java
@@ -45,10 +45,9 @@ public final class BSQConsistencyTest extends CoverageReadConsistency<RawRasterS
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="7", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private static RawRasterStore openFile() throws IOException, DataStoreException {
final URL url = BSQConsistencyTest.class.getResource("BSQ.raw");
assertNotNull(url, "Test file not found.");
@@ -56,11 +55,10 @@ public final class BSQConsistencyTest extends CoverageReadConsistency<RawRasterS
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
@Override
- @Workaround(library="JDK", version="7", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
protected GridCoverageResource resource() throws DataStoreException {
return store;
}
diff --git a/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/image/SelfConsistencyTest.java b/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/image/SelfConsistencyTest.java
index 3b4420bda5..e3169ac7d0 100644
--- a/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/image/SelfConsistencyTest.java
+++ b/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/image/SelfConsistencyTest.java
@@ -49,10 +49,9 @@ public final class SelfConsistencyTest extends CoverageReadConsistency<WorldFile
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="7", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private static WorldFileStore openFile() throws IOException, DataStoreException {
final URL url = WorldFileStoreTest.class.getResource("gradient.png");
assertNotNull(url, "Test file not found.");
@@ -60,11 +59,10 @@ public final class SelfConsistencyTest extends CoverageReadConsistency<WorldFile
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
@Override
- @Workaround(library="JDK", version="7", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
protected GridCoverageResource resource() throws DataStoreException {
return store.components().iterator().next();
}
diff --git a/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/test/CoverageReadConsistency.java b/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/test/CoverageReadConsistency.java
index ae7a4460bd..50751b43ab 100644
--- a/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/test/CoverageReadConsistency.java
+++ b/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/test/CoverageReadConsistency.java
@@ -180,14 +180,12 @@ public abstract class CoverageReadConsistency<S extends DataStore> extends TestC
* This method shall not use any other field and shall not invoke any other method,
* because this method is invoked during object construction.
*
- * <p>This method is a work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors")
- * and will be removed (replaced by constructor argument) in a future version.</p>
+ * <p>This method is a work around for JEP 513.</p>
*
* @return the resource to test.
* @throws DataStoreException if an error occurred while reading the resource.
*/
- @Workaround(library="JDK", version="7", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
protected abstract GridCoverageResource resource() throws DataStoreException;
/**
diff --git a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/internal/shared/LocalizedParseException.java b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/internal/shared/LocalizedParseException.java
index da4566bd12..7f7cc74cc0 100644
--- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/internal/shared/LocalizedParseException.java
+++ b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/internal/shared/LocalizedParseException.java
@@ -93,9 +93,9 @@ public final class LocalizedParseException extends ParseException implements Loc
}
/**
- * Workaround while waiting for JEP 447: Statements before super(…).
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="1.8")
+ @Workaround(library="JDK", version="11", fixed="25")
private LocalizedParseException(final Locale locale, final Class<?> type,
final CharSequence text, final int offset, final int errorOffset)
{
@@ -103,15 +103,15 @@ public final class LocalizedParseException extends ParseException implements Loc
}
/**
- * Workaround while waiting for JEP 447: Statements before super(…).
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="1.8")
+ @Workaround(library="JDK", version="11", fixed="25")
private LocalizedParseException(final Locale locale, final Object[] parameters, final int errorOffset) {
this(locale, key(parameters), parameters, errorOffset);
}
/**
- * Workaround while waiting for JEP 447: Statements before super(…).
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*
* @param type the type of objects parsed by the {@link java.text.Format}.
* @param text the text that {@code Format} failed to parse.
@@ -119,7 +119,7 @@ public final class LocalizedParseException extends ParseException implements Loc
* @param errorOffset the position where the error is found while parsing.
* @return the {@code parameters} value to give to the constructor.
*/
- @Workaround(library="JDK", version="1.8")
+ @Workaround(library="JDK", version="11", fixed="25")
private static Object[] parameters(final Class<?> type, CharSequence text, final int offset, final int errorOffset) {
if (errorOffset >= text.length()) {
return new Object[] {text};
@@ -133,9 +133,9 @@ public final class LocalizedParseException extends ParseException implements Loc
}
/**
- * Workaround while waiting for JEP 447: Statements before super(…).
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="1.8")
+ @Workaround(library="JDK", version="11", fixed="25")
private static short key(final Object[] parameters) {
final short key;
switch (parameters.length) {
diff --git a/endorsed/src/org.apache.sis.util/test/org/apache/sis/test/Printer.java b/endorsed/src/org.apache.sis.util/test/org/apache/sis/test/Printer.java
index b504da1115..3a1c5dcbf9 100644
--- a/endorsed/src/org.apache.sis.util/test/org/apache/sis/test/Printer.java
+++ b/endorsed/src/org.apache.sis.util/test/org/apache/sis/test/Printer.java
@@ -56,10 +56,9 @@ public final class Printer extends PrintWriter {
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="7", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private Printer(final StringWriter buffer) {
super(buffer);
this.buffer = buffer;
diff --git a/incubator/src/org.apache.sis.storage.geopackage/main/org/apache/sis/storage/geopackage/GpkgStore.java b/incubator/src/org.apache.sis.storage.geopackage/main/org/apache/sis/storage/geopackage/GpkgStore.java
index 5f2c580aa1..553c383ef1 100644
--- a/incubator/src/org.apache.sis.storage.geopackage/main/org/apache/sis/storage/geopackage/GpkgStore.java
+++ b/incubator/src/org.apache.sis.storage.geopackage/main/org/apache/sis/storage/geopackage/GpkgStore.java
@@ -140,10 +140,9 @@ public class GpkgStore extends SQLStore implements WritableAggregate {
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
*/
- @Workaround(library="JDK", version="7", fixed="25")
+ @Workaround(library="JDK", version="11", fixed="25")
private GpkgStore(final DataStoreProvider provider, final Initializer init) throws DataStoreException {
super(provider, init.connector);
path = init.path;
diff --git a/incubator/src/org.apache.sis.storage.geopackage/main/org/apache/sis/storage/geopackage/Initializer.java b/incubator/src/org.apache.sis.storage.geopackage/main/org/apache/sis/storage/geopackage/Initializer.java
index 8fc16d3d01..fddb647b8d 100644
--- a/incubator/src/org.apache.sis.storage.geopackage/main/org/apache/sis/storage/geopackage/Initializer.java
+++ b/incubator/src/org.apache.sis.storage.geopackage/main/org/apache/sis/storage/geopackage/Initializer.java
@@ -42,12 +42,11 @@ import org.apache.sis.util.Workaround;
* A helper class for initializing a {@code GpkgStore}.
* A temporary instance exists at construction time, then is discarded.
*
- * This is a work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in constructors").
+ * This is a work around while waiting for JEP 513: Flexible Constructor Bodies.
*
* @author Martin Desruisseaux (Geomatys).
*/
-@Workaround(library="JDK", version="7", fixed="25")
+@Workaround(library="JDK", version="11", fixed="25")
final class Initializer {
/**
* Suffixes of auxiliary files.
(sis) 03/05: Fix a wrong encoding in logging property files. That particular case is fixed to ISO-LATIN-1.
Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
asf-gitbox-commits pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git
commit c12db320713549979ab23cbb6a316e1083093924
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Fri Oct 16 15:54:22 2026 +0200
Fix a wrong encoding in logging property files.
That particular case is fixed to ISO-LATIN-1.
---
.../main/org/apache/sis/util/logging/Initializer.java | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/logging/Initializer.java b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/logging/Initializer.java
index 5c2f11e9d8..f7a02b025a 100644
--- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/logging/Initializer.java
+++ b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/logging/Initializer.java
@@ -22,6 +22,7 @@ import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.IOException;
import java.io.File;
+import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -131,7 +132,7 @@ public class Initializer {
*/
public static void reload(Path path) throws IOException {
path = path.normalize();
- final StringBuilder buffer = new StringBuilder(600);
+ final var buffer = new StringBuilder(600);
for (String line : Files.readAllLines(path)) {
if (!(line = line.trim()).isEmpty() && line.charAt(0) != '#') {
final int base = buffer.length();
@@ -140,7 +141,7 @@ public class Initializer {
final int i = buffer.indexOf(PATTERN, base + PATTERN_PROPERTY.length());
if (i >= 0) {
Path parent = path;
- for (int j=Math.min(parent.getNameCount(), 2); --j >= 0;) {
+ for (int j = Math.min(parent.getNameCount(), 2); --j >= 0;) {
parent = parent.getParent();
}
String replacement = (parent != null) ? parent.toString() : ".";
@@ -150,6 +151,7 @@ public class Initializer {
}
}
}
- LogManager.getLogManager().readConfiguration(new ByteArrayInputStream(buffer.toString().getBytes()));
+ LogManager.getLogManager().readConfiguration(new ByteArrayInputStream(
+ buffer.toString().getBytes(StandardCharsets.ISO_8859_1)));
}
}
(sis) 05/05: Upgrade from Java 11 to Java 12. The plan is to upgrade to a higher version, but this small step is done first for testing if there is any user reaction.
Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
asf-gitbox-commits pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git
commit b05e8580ae821a42c5e0c836b74b6649c9acc841
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Sat Oct 17 01:30:27 2026 +0200
Upgrade from Java 11 to Java 12. The plan is to upgrade to a higher version,
but this small step is done first for testing if there is any user reaction.
---
README.md | 2 +-
endorsed/build.gradle.kts | 2 +-
.../apache/sis/storage/geoheif/ImageResource.java | 2 +-
.../sis/storage/internal/InputStreamAdapter.java | 2 +-
.../main/org/apache/sis/pending/jdk/JDK12.java | 44 ----------------------
.../main/org/apache/sis/pending/jdk/JDK13.java | 2 +-
.../main/org/apache/sis/pending/jdk/JDK15.java | 2 +-
.../main/org/apache/sis/pending/jdk/JDK16.java | 2 +-
.../main/org/apache/sis/pending/jdk/JDK17.java | 2 +-
.../main/org/apache/sis/pending/jdk/JDK18.java | 2 +-
.../main/org/apache/sis/pending/jdk/JDK19.java | 2 +-
.../main/org/apache/sis/pending/jdk/JDK20.java | 2 +-
.../main/org/apache/sis/pending/jdk/JDK21.java | 2 +-
.../main/org/apache/sis/pending/jdk/JDK22.java | 2 +-
.../main/org/apache/sis/pending/jdk/JDK23.java | 2 +-
.../main/org/apache/sis/pending/jdk/JDK26.java | 2 +-
.../org/apache/sis/pending/jdk/package-info.java | 2 +-
.../main/org/apache/sis/util/Classes.java | 21 +----------
optional/README.md | 2 +-
optional/src/org.apache.sis.gui/bundle/README | 2 +-
parent/overview.html | 2 +-
parent/pom.xml | 4 +-
22 files changed, 23 insertions(+), 84 deletions(-)
diff --git a/README.md b/README.md
index c1df4f7f39..4b85c5ce08 100644
--- a/README.md
+++ b/README.md
@@ -27,7 +27,7 @@ project logo are trademarks of The Apache Software Foundation.
## Build from sources
-Running the library part of Apache SIS requires Java 11 or higher.
+Running the library part of Apache SIS requires Java 12 or higher.
Running the JavaFX application part requires Java 22 or higher.
Building SIS requires Java 22 or higher
together with [Gradle](https://gradle.org/) 8 build system.
diff --git a/endorsed/build.gradle.kts b/endorsed/build.gradle.kts
index d2d53a4cd9..2785080913 100644
--- a/endorsed/build.gradle.kts
+++ b/endorsed/build.gradle.kts
@@ -101,7 +101,7 @@ dependencies {
var srcDir = file("src") // Must be the same as the hard-coded value in `BuildHelper.java`.
tasks.compileJava {
dependsOn(":geoapi:rebuild")
- options.release.set(11) // The version of both Java source code and compiled byte code.
+ options.release.set(12) // The version of both Java source code and compiled byte code.
}
tasks.compileTestJava {
options.compilerArgs.add("-source") // "source", not "release", because we accept any target version.
diff --git a/endorsed/src/org.apache.sis.storage.geoheif/main/org/apache/sis/storage/geoheif/ImageResource.java b/endorsed/src/org.apache.sis.storage.geoheif/main/org/apache/sis/storage/geoheif/ImageResource.java
index a431290c32..e7ba0e6c65 100644
--- a/endorsed/src/org.apache.sis.storage.geoheif/main/org/apache/sis/storage/geoheif/ImageResource.java
+++ b/endorsed/src/org.apache.sis.storage.geoheif/main/org/apache/sis/storage/geoheif/ImageResource.java
@@ -377,7 +377,7 @@ final class ImageResource extends TiledGridCoverageResource implements StoreReso
* <p><b>Note:</b> this is defined as an inner class of {@link TiledGridCoverage} subclass
* because, at the time of writing this class, {@link AOI} is a protected class.</p>
*/
- // TODO: make static when allowed to compile with JDK12 (exact version not verified).
+ // TODO: make static when allowed to compile with JDK13 (exact version not verified).
final class ReadContext extends ByteRanges {
/**
* Iterator over the tiles to read.
diff --git a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/internal/InputStreamAdapter.java b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/internal/InputStreamAdapter.java
index bff6009366..ad4fb6189d 100644
--- a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/internal/InputStreamAdapter.java
+++ b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/internal/InputStreamAdapter.java
@@ -169,7 +169,7 @@ public final class InputStreamAdapter extends InputStream implements Markable {
* @param count number of bytes to skip.
* @throws IOException if an I/O error occurs.
*/
-// @Override // Pending JDK12.
+ @Override
public void skipNBytes(final long count) throws IOException {
input.seek(Math.addExact(input.getStreamPosition(), count));
}
diff --git a/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK12.java b/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK12.java
deleted file mode 100644
index 680835fdec..0000000000
--- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK12.java
+++ /dev/null
@@ -1,44 +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.pending.jdk;
-
-
-/**
- * Place holder for some functionalities defined in a JDK more recent than Java 11.
- *
- * @author Martin Desruisseaux (Geomatys)
- */
-public final class JDK12 {
- /**
- * Do not allow instantiation of this class.
- */
- private JDK12() {
- }
-
- public static String descriptorString(Class<?> c) {
- if (c == Double.TYPE) return "D";
- if (c == Float.TYPE) return "F";
- if (c == Long.TYPE) return "J";
- if (c == Integer.TYPE) return "I";
- if (c == Short.TYPE) return "S";
- if (c == Byte.TYPE) return "B";
- if (c == Character.TYPE) return "C";
- if (c == Boolean.TYPE) return "Z";
- if (c == Void.TYPE) return "V";
- return "L" + c.getCanonicalName() + ';';
- }
-}
diff --git a/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK13.java b/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK13.java
index 26365ef0fb..2db735633e 100644
--- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK13.java
+++ b/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK13.java
@@ -20,7 +20,7 @@ import java.nio.ByteBuffer;
/**
- * Place holder for some functionalities defined in a JDK more recent than Java 11.
+ * Place holder for some functionalities defined in a JDK more recent than the targeted version.
*
* @author Martin Desruisseaux (Geomatys)
*/
diff --git a/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK15.java b/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK15.java
index 87fd71dc18..4e43ce78a9 100644
--- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK15.java
+++ b/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK15.java
@@ -18,7 +18,7 @@ package org.apache.sis.pending.jdk;
/**
- * Place holder for some functionalities defined in a JDK more recent than Java 11.
+ * Place holder for some functionalities defined in a JDK more recent than the targeted version11.
*
* @author Martin Desruisseaux (Geomatys)
*/
diff --git a/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK16.java b/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK16.java
index a8b1a165ec..ff5d798a57 100644
--- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK16.java
+++ b/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK16.java
@@ -23,7 +23,7 @@ import java.util.stream.Collectors;
/**
- * Place holder for some functionalities defined in a JDK more recent than Java 11.
+ * Place holder for some functionalities defined in a JDK more recent than the targeted version.
*
* @author Martin Desruisseaux (Geomatys)
*/
diff --git a/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK17.java b/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK17.java
index e9cbb105c5..0ab2d064cb 100644
--- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK17.java
+++ b/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK17.java
@@ -21,7 +21,7 @@ import java.nio.charset.Charset;
/**
- * Place holder for some functionalities defined in a JDK more recent than Java 11.
+ * Place holder for some functionalities defined in a JDK more recent than the targeted version.
*
* @author Martin Desruisseaux (Geomatys)
*/
diff --git a/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK18.java b/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK18.java
index 419bcc225f..eff8e34f4b 100644
--- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK18.java
+++ b/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK18.java
@@ -20,7 +20,7 @@ import java.time.Duration;
/**
- * Place holder for some functionalities defined in a JDK more recent than Java 11.
+ * Place holder for some functionalities defined in a JDK more recent than the targeted version.
*
* @author Martin Desruisseaux (Geomatys)
*/
diff --git a/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK19.java b/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK19.java
index f492f4d064..7d87b66009 100644
--- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK19.java
+++ b/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK19.java
@@ -25,7 +25,7 @@ import static org.apache.sis.util.collection.Containers.hashMapCapacity;
/**
- * Place holder for some functionalities defined in a JDK more recent than Java 11.
+ * Place holder for some functionalities defined in a JDK more recent than the targeted version.
*
* @author Martin Desruisseaux (Geomatys)
*/
diff --git a/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK20.java b/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK20.java
index 2142cc573a..e991283cf2 100644
--- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK20.java
+++ b/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK20.java
@@ -25,7 +25,7 @@ import java.nio.file.attribute.BasicFileAttributes;
/**
- * Place holder for some functionalities defined in a JDK more recent than Java 11.
+ * Place holder for some functionalities defined in a JDK more recent than the targeted version.
*
* @author Martin Desruisseaux (Geomatys)
*/
diff --git a/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK21.java b/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK21.java
index c1a56e0023..84679443e4 100644
--- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK21.java
+++ b/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK21.java
@@ -26,7 +26,7 @@ import java.util.NoSuchElementException;
/**
- * Place holder for some functionalities defined in a JDK more recent than Java 11.
+ * Place holder for some functionalities defined in a JDK more recent than the targeted version.
*
* @author Martin Desruisseaux (Geomatys)
*/
diff --git a/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK22.java b/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK22.java
index e7f2c31c5f..176fea69e6 100644
--- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK22.java
+++ b/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK22.java
@@ -21,7 +21,7 @@ import java.nio.file.Path;
/**
- * Place holder for some functionalities defined in a JDK more recent than Java 11.
+ * Place holder for some functionalities defined in a JDK more recent than the targeted version.
*
* @author Martin Desruisseaux (Geomatys)
*/
diff --git a/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK23.java b/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK23.java
index a29acac022..85f237878e 100644
--- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK23.java
+++ b/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK23.java
@@ -21,7 +21,7 @@ import java.time.Instant;
/**
- * Place holder for some functionalities defined in a JDK more recent than Java 11.
+ * Place holder for some functionalities defined in a JDK more recent than the targeted version.
*
* @author Martin Desruisseaux (Geomatys)
*/
diff --git a/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK26.java b/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK26.java
index c2f442f8be..f86c35bc26 100644
--- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK26.java
+++ b/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK26.java
@@ -18,7 +18,7 @@ package org.apache.sis.pending.jdk;
/**
- * Place holder for some functionalities defined in a JDK more recent than Java 11.
+ * Place holder for some functionalities defined in a JDK more recent than the targeted version.
*
* @author Martin Desruisseaux (Geomatys)
*/
diff --git a/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/package-info.java b/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/package-info.java
index 09b228087e..e83169da04 100644
--- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/package-info.java
+++ b/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/package-info.java
@@ -16,7 +16,7 @@
*/
/**
- * Place-holder for classes that do not exist in JDK 11.
+ * Place-holder for classes that do not exist in targeted Java version.
*
* <STRONG>Do not use!</STRONG>
*
diff --git a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/Classes.java b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/Classes.java
index 6ae22a43c5..ac99f02986 100644
--- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/Classes.java
+++ b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/Classes.java
@@ -34,7 +34,6 @@ import java.lang.reflect.GenericDeclaration;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Modifier;
import org.opengis.annotation.UML;
-import org.apache.sis.pending.jdk.JDK12;
/**
@@ -55,7 +54,7 @@ import org.apache.sis.pending.jdk.JDK12;
* </ul>
*
* @author Martin Desruisseaux (IRD, Geomatys)
- * @version 1.7
+ * @version 1.8
* @since 0.3
*/
public final class Classes {
@@ -116,24 +115,8 @@ public final class Classes {
do element = element.getComponentType();
while (element!=null && ++change != 0);
} else if (element != Void.TYPE) {
- // TODO: use Class.arrayType() with JDK12.
- final var buffer = new StringBuilder();
- do buffer.insert(0, '[');
+ do element = element.arrayType();
while (--change != 0);
- if (element.isPrimitive()) {
- buffer.append(JDK12.descriptorString(element));
- } else if (element.isArray()) {
- buffer.append(element.getName());
- } else {
- buffer.append('L').append(element.getName()).append(';');
- }
- final String name = buffer.toString();
- try {
- element = Class.forName(name);
- } catch (ClassNotFoundException e) {
- throw new TypeNotPresentException(name, e);
- // Should never happen because we are creating an array of an existing class.
- }
}
}
return element;
diff --git a/optional/README.md b/optional/README.md
index 32cccd5bf5..a28046e530 100644
--- a/optional/README.md
+++ b/optional/README.md
@@ -8,7 +8,7 @@ If those dependencies are not provided, Apache SIS [endorsed](../endorsed)
modules will still work but without Graphical User Interface (GUI).
GDAL is temporarily provided as an optional module despite its permissive license
-because it requires Java 22, while the main Apache SIS modules target Java 11.
+because it requires Java 22, while the main Apache SIS modules target Java 12.
## Configuration
diff --git a/optional/src/org.apache.sis.gui/bundle/README b/optional/src/org.apache.sis.gui/bundle/README
index a5fc2aab27..b088dbb0c1 100644
--- a/optional/src/org.apache.sis.gui/bundle/README
+++ b/optional/src/org.apache.sis.gui/bundle/README
@@ -14,7 +14,7 @@ Installation
============
For developing applications using the SIS library or for using on command-line,
-the only requirement is Java 11 or later, except the GDAL module which requires
+the only requirement is Java 12 or later, except the GDAL module which requires
Java 22. For launching the desktop application, requirements are Java 22 or later
and JavaFX 24 or later.
diff --git a/parent/overview.html b/parent/overview.html
index 0d97dabd0c..495ed4c0c7 100644
--- a/parent/overview.html
+++ b/parent/overview.html
@@ -28,7 +28,7 @@
Overview of <a href="http://sis.apache.org">Apache SIS™ (Spatial Information System)</a>.
<h1>Requirements</h1>
- <p>SIS requires Java 11 Standard Edition.</p>
+ <p>Apache <abbr>SIS</abbr> requires Java 12 Standard Edition.</p>
<h1>Classes naming</h1>
<p>Implementations of <a href="http://www.geoapi.org/">GeoAPI interfaces</a> usually (but not always)
diff --git a/parent/pom.xml b/parent/pom.xml
index 21483755aa..f8cab48455 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -425,8 +425,8 @@
=================================================================== -->
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <maven.compiler.source>11</maven.compiler.source>
- <maven.compiler.target>11</maven.compiler.target>
+ <maven.compiler.source>12</maven.compiler.source>
+ <maven.compiler.target>12</maven.compiler.target>
</properties>
</project>
(sis) 04/05: Partial workaround for the problem of HSQL which ignore collations in LIKE clause. We cannot compensate fully this problem, but we can make it less frequent.
Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
asf-gitbox-commits pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git
commit 27beef8199f07ad2e458967ee722f6dd2d2c8c12
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Sat Oct 17 00:33:40 2026 +0200
Partial workaround for the problem of HSQL which ignore collations in LIKE clause.
We cannot compensate fully this problem, but we can make it less frequent.
---
.../sis/metadata/sql/internal/shared/Dialect.java | 11 ++++
.../metadata/sql/internal/shared/SQLBuilder.java | 3 +-
.../metadata/sql/internal/shared/ScriptRunner.java | 4 +-
.../sis/metadata/sql/internal/shared/Supports.java | 8 ++-
.../factory/ConcurrentAuthorityFactory.java | 2 +-
.../factory/IdentifiedObjectFinder.java | 2 +-
.../referencing/factory/sql/EPSGCodeFinder.java | 61 ++++++++++++++++------
.../sis/referencing/factory/sql/EPSGInstaller.java | 4 ++
.../sis/referencing/factory/sql/SQLTranslator.java | 16 +++++-
.../sis/referencing/factory/sql/package-info.java | 2 +-
.../main/org/apache/sis/pending/jdk/JDK26.java | 41 +++++++++++++++
11 files changed, 130 insertions(+), 24 deletions(-)
diff --git a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/sql/internal/shared/Dialect.java b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/sql/internal/shared/Dialect.java
index adbf5d1e63..ff2a4ee83e 100644
--- a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/sql/internal/shared/Dialect.java
+++ b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/sql/internal/shared/Dialect.java
@@ -49,6 +49,7 @@ public enum Dialect {
* <a href="https://issues.apache.org/jira/browse/DERBY-6445">DERBY-6445</a>
*/
DERBY("derby", Supports.ALTER_TABLE_WITH_ADD_CONSTRAINT
+ | Supports.COLLATION_IN_LIKE
| Supports.READ_ONLY_UPDATE
| Supports.CONCURRENCY),
@@ -82,6 +83,7 @@ public enum Dialect {
| Supports.CONCURRENCY
| Supports.JAVA_TIME
| Supports.ILIKE
+ | Supports.COLLATION_IN_LIKE // Since PostgreSQL 18.
| Supports.SRID),
/**
@@ -271,6 +273,15 @@ public enum Dialect {
return (flags & Supports.SRID) != 0;
}
+ /**
+ * Whether the database takes collation in account in {@code LIKE} clauses.
+ *
+ * @return whether the database supports collations in {@code LIKE} clauses.
+ */
+ public final boolean supportsCollationInLike() {
+ return (flags & Supports.COLLATION_IN_LIKE) != 0;
+ }
+
/**
* Returns the keyword for a case-insensitive {@code LIKE}, or {@code null} if none.
* The default implementation returns {@code null} because {@code ILIKE} is not standard <abbr>SQL</abbr>.
diff --git a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/sql/internal/shared/SQLBuilder.java b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/sql/internal/shared/SQLBuilder.java
index 2455bff4f5..2fdd2fbffd 100644
--- a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/sql/internal/shared/SQLBuilder.java
+++ b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/sql/internal/shared/SQLBuilder.java
@@ -258,7 +258,7 @@ public class SQLBuilder extends Syntax {
/**
* Appends a {@code "= <value>"} string in a {@code SELECT} statement.
- * The value is written between quotes, except if it is a number or a boolean.
+ * The value is written between quotes, except if it is a number or a Boolean.
*
* @param value the value to append, or {@code null}.
* @return this builder, for method call chaining.
@@ -278,6 +278,7 @@ public class SQLBuilder extends Syntax {
* @return this builder, for method call chaining.
*/
public final SQLBuilder appendValue(final String value) {
+ // TODO: use Connection.enquoteLiteral(String) with JDK26.
return (value == null) ? append(NULL) : append('\'').append(value.replace("'", "''")).append('\'');
}
diff --git a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/sql/internal/shared/ScriptRunner.java b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/sql/internal/shared/ScriptRunner.java
index 84ab3300d0..cf7ba6d13a 100644
--- a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/sql/internal/shared/ScriptRunner.java
+++ b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/sql/internal/shared/ScriptRunner.java
@@ -178,8 +178,8 @@ public class ScriptRunner implements AutoCloseable {
* In principle, {@link Connection#rollback()} should be sufficient, but it appears to not be the case
* with all databases.
*
- * <p>This is a workaround for what seems to be a bug in <abbr>HSQLDB</abbr>, where
- * {@link Connection#rollback()} does drop the schema created before the rollback.</p>
+ * <p>This is a workaround for a limitation in <abbr>HSQLDB</abbr>, where
+ * {@link Connection#rollback()} does not drop the schema created before the rollback.</p>
*
* @see <a href="https://sourceforge.net/p/hsqldb/bugs/1754/">Connection.rollback() does not remove schemas</a>
*/
diff --git a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/sql/internal/shared/Supports.java b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/sql/internal/shared/Supports.java
index bf4b3e9765..5bd73cec98 100644
--- a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/sql/internal/shared/Supports.java
+++ b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/sql/internal/shared/Supports.java
@@ -86,10 +86,16 @@ final class Supports {
*/
public static final int ILIKE = 0x200;
+ /**
+ * Whether the database supports collations in {@code LIKE} clauses.
+ * Some databases support collations in {@code =} comparisons but silently ignore it in {@code LIKE} clauses.
+ */
+ public static final int COLLATION_IN_LIKE = 0x400;
+
/**
* Whether the spatial extension supports <abbr>SRID</abbr> in {@code ST_*} functions.
*/
- public static final int SRID = 0x400;
+ public static final int SRID = 0x800;
/**
* Do not allow instantiation of this class.
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java
index 32cf7fb30d..dbd98f44c4 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java
@@ -300,7 +300,7 @@ public abstract class ConcurrentAuthorityFactory<DAO extends GeodeticAuthorityFa
* If more than this number of threads are querying this {@code ConcurrentAuthorityFactory} concurrently,
* additional threads will be blocked until a Data Access Object become available.
*/
- @SuppressWarnings("this-escape") // Phantom reference.
+ @SuppressWarnings({"this-escape", "LeakingThisInConstructor"}) // Phantom reference.
protected ConcurrentAuthorityFactory(final Class<DAO> dataAccessClass,
final int maxStrongReferences, final int maxConcurrentQueries)
{
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/IdentifiedObjectFinder.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/IdentifiedObjectFinder.java
index 49c7bd77f8..aed8f8eaf0 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/IdentifiedObjectFinder.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/IdentifiedObjectFinder.java
@@ -447,7 +447,7 @@ public class IdentifiedObjectFinder {
/** Snapshot of {@link IdentifiedObjectFinder#proxy}. */
private final AuthorityFactoryProxy<?> proxy;
- /** The authority codes form which to create object candidates. */
+ /** The authority codes from which to create object candidates. */
private final Iterable<String> codes;
/** The comparison mode for deciding if a candidate is a match. */
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSGCodeFinder.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSGCodeFinder.java
index 36f13b09a4..3f8040eb23 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSGCodeFinder.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSGCodeFinder.java
@@ -16,10 +16,12 @@
*/
package org.apache.sis.referencing.factory.sql;
+import java.util.Map;
import java.util.Set;
import java.util.List;
import java.util.ArrayList;
import java.util.LinkedHashSet;
+import java.util.LinkedHashMap;
import java.util.Collection;
import java.util.Iterator;
import java.sql.Statement;
@@ -54,6 +56,7 @@ import org.apache.sis.util.collection.Containers;
import org.apache.sis.util.collection.BackingStoreException;
import org.apache.sis.pending.jdk.JDK16;
import org.apache.sis.pending.jdk.JDK19;
+import org.apache.sis.pending.jdk.JDK26;
import org.apache.sis.metadata.internal.shared.ReferencingServices;
import org.apache.sis.metadata.iso.citation.Citations;
import org.apache.sis.referencing.IdentifiedObjects;
@@ -434,20 +437,22 @@ crs: if (isInstance(CoordinateReferenceSystem.class, object)) {
* so that buffer shall not contain valuable information yet.
*/
final var buffer = new StringBuilder(350); // Temporary buffer for building SQL query.
- final Set<String> namePatterns; // Name including aliases.
+ final Map<String, String> namePatterns; // Name and aliases as keys, LIKE patterns as values.
final String aliasSQL;
if (ArraysExt.containsIdentity(filters, Condition.NAME)) {
- namePatterns = new LinkedHashSet<>();
- namePatterns.add(toDatumPattern(getName(object), buffer));
- for (final GenericName id : object.getAlias()) {
- namePatterns.add(toDatumPattern(id.tip().toString(), buffer));
+ namePatterns = new LinkedHashMap<>();
+ String name = getName(object);
+ namePatterns.put(name, toDatumPattern(name, buffer));
+ for (final GenericName alias : object.getAlias()) {
+ name = alias.tip().toString();
+ namePatterns.put(name, toDatumPattern(name, buffer));
}
buffer.setLength(0);
buffer.append("SELECT OBJECT_CODE FROM \"Alias\" WHERE OBJECT_TABLE_NAME='")
.append(dao.translator.toActualTableName(source.table))
.append("' AND ");
// PostgreSQL does not require explicit cast when the value is a literal instead of "?".
- appendLikeNames(namePatterns, "ALIAS", buffer);
+ appendLikeNames(namePatterns, "ALIAS", dao.translator.supportsCollationInLike, buffer);
aliasSQL = dao.translator.apply(buffer.toString());
buffer.setLength(0);
} else {
@@ -480,9 +485,11 @@ crs: if (isInstance(CoordinateReferenceSystem.class, object)) {
*/
try (Statement stmt = dao.connection.createStatement()) {
if (namePatterns != null) {
- if (isNext) buffer.append(" AND ");
- isNext = false;
- appendLikeNames(namePatterns, source.nameColumn, buffer);
+ if (isNext) {
+ isNext = false;
+ buffer.append(" AND ");
+ }
+ appendLikeNames(namePatterns, source.nameColumn, dao.translator.supportsCollationInLike, buffer);
try (ResultSet result = stmt.executeQuery(aliasSQL)) {
while (result.next()) {
final int code = result.getInt(1);
@@ -594,18 +601,42 @@ crs: if (isInstance(CoordinateReferenceSystem.class, object)) {
* (<column> LIKE '<pattern>' OR …)
* }
*
+ * Theoretically, using only the above {@code LIKE} conditions should be sufficient.
+ * However, some databases support collations only during comparisons with {@code =}
+ * and ignores collations when using {@code LIKE}. If the databases is known to have
+ * this limitation, the {@code supportsCollationInLike} flag should be {@code false}
+ * for writing all conditions twice: once with {@code =} and once with {@code LIKE}.
+ * This duplication can mitigate the problem, but not fully resolve it.
+ *
* This method assumes that {@code namePatterns} contains at least one element.
*
* @param namePatterns the patterns created by {@link #toDatumPattern(String, StringBuilder)}.
* @param column column where the search for the names.
* @param buffer buffer where to add the SQL fragment.
*/
- private static void appendLikeNames(final Set<String> namePatterns, final String column, final StringBuilder buffer) {
- String separator = "(";
- for (final String pattern : namePatterns) {
- buffer.append(separator).append(column).append(" LIKE '").append(pattern).append('\'');
- separator = " OR ";
- }
+ private static void appendLikeNames(final Map<String, String> namePatterns, final String column,
+ boolean supportsCollationInLike, final StringBuilder buffer)
+ {
+ buffer.append('(');
+ boolean isNext = false;
+ do {
+ for (final Map.Entry<String, String> entry : namePatterns.entrySet()) {
+ if (isNext) {
+ buffer.append(" OR ");
+ }
+ final String name;
+ final String operator;
+ if (supportsCollationInLike) {
+ name = entry.getValue(); // LIKE pattern.
+ operator = " LIKE ";
+ } else {
+ name = entry.getKey(); // Original name.
+ operator = " = ";
+ }
+ buffer.append(column).append(operator).append(JDK26.enquoteLiteral(name));
+ isNext = true;
+ }
+ } while ((supportsCollationInLike = !supportsCollationInLike) == true);
buffer.append(')');
}
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSGInstaller.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSGInstaller.java
index cd8f9a434c..5ffe3d52ee 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSGInstaller.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSGInstaller.java
@@ -63,10 +63,14 @@ final class EPSGInstaller extends ScriptRunner {
/**
* Creates a new runner which will execute the statements using the given connection.
* This constructor creates immediately a schema of the given name in the database.
+ * Replacements are prepared for features not supported by the target database,
+ * such as enumerations and collations.
*
* @param connection the connection to the database.
* @param schema the schema, or {@code null} for any, or empty for none.
* @throws SQLException if an error occurred while executing a SQL statement.
+ *
+ * @see <a href="https://hsqldb.org/doc/guide/databaseobjects-chapt.html#dbc_collations">HSQLDB collations</a>
*/
public EPSGInstaller(final Connection connection, final String schema) throws SQLException {
super(connection, schema == null ? Constants.EPSG : schema.isEmpty() ? null : schema, 100);
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/SQLTranslator.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/SQLTranslator.java
index 11bf562de0..de2b2b0003 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/SQLTranslator.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/SQLTranslator.java
@@ -26,11 +26,13 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Types;
+import org.apache.sis.util.Workaround;
import org.apache.sis.util.CharSequences;
import org.apache.sis.util.OptionalCandidate;
import org.apache.sis.util.StringBuilders;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.internal.shared.Constants;
+import org.apache.sis.metadata.sql.internal.shared.Dialect;
import org.apache.sis.metadata.sql.internal.shared.Reflection;
import org.apache.sis.metadata.sql.internal.shared.SQLUtilities;
import org.apache.sis.referencing.internal.Resources;
@@ -202,7 +204,7 @@ public class SQLTranslator implements UnaryOperator<String> {
* and values are the names used in the <abbr>EPSG</abbr> database on which {@link EPSGDataAccess} is connected.
* By convention, all column names are in upper-case while table names are in mixed-case characters.</p>
*/
- private Map<String,String> tableRewording;
+ private Map<String, String> tableRewording;
/**
* Replacements to perform on <abbr>SQL</abbr> statements before execution. Some entries are the replacements
@@ -211,7 +213,7 @@ public class SQLTranslator implements UnaryOperator<String> {
* Other entries are replacements of missing columns by {@code CAST(NULL AS …)} expressions and replacements
* of {@code BOOLEAN} comparator operands by {@code SMALLINT}.
*/
- private Map<String,String> replacements;
+ private Map<String, String> replacements;
/**
* The characters used for quoting identifiers, or an empty string if none.
@@ -242,6 +244,15 @@ public class SQLTranslator implements UnaryOperator<String> {
*/
private boolean useBoolean;
+ /**
+ * Whether the database takes collation in account in {@code LIKE} clauses.
+ * Collations were working well in Derby, but the migration to HSQLDB forces
+ * us to create redundant conditions in the <abbr>SQL</abbr> statement without
+ * reaching the same power as Derby or PostgreSQL.
+ */
+ @Workaround(library="HSQLDB", version="2.7.4")
+ final boolean supportsCollationInLike;
+
/**
* Whether the sentinel table {@code "Coordinate_Operation"} or a variant has been found.
* If {@code false}, then {@link EPSGInstaller} needs to be run.
@@ -287,6 +298,7 @@ public class SQLTranslator implements UnaryOperator<String> {
* @throws SQLException if an error occurred while querying the database metadata.
*/
public SQLTranslator(final DatabaseMetaData md, final String catalog, final String schema) throws SQLException {
+ supportsCollationInLike = Dialect.guess(md).supportsCollationInLike();
identifierQuote = md.getIdentifierQuoteString().trim();
wildcardEscape = md.getSearchStringEscape();
this.catalog = catalog;
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/package-info.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/package-info.java
index 7a366ea7a1..9c3be9e7c9 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/package-info.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/package-info.java
@@ -83,7 +83,7 @@
* @author Jody Garnett (Refractions)
* @author Didier Richard (IGN)
* @author John Grange
- * @version 1.7
+ * @version 1.8
*
* @see org.apache.sis.metadata.sql
*
diff --git a/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK26.java b/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK26.java
new file mode 100644
index 0000000000..c2f442f8be
--- /dev/null
+++ b/endorsed/src/org.apache.sis.util/main/org/apache/sis/pending/jdk/JDK26.java
@@ -0,0 +1,41 @@
+/*
+ * 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.pending.jdk;
+
+
+/**
+ * Place holder for some functionalities defined in a JDK more recent than Java 11.
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ */
+public final class JDK26 {
+ /**
+ * Do not allow instantiation of this class.
+ */
+ private JDK26() {
+ }
+
+ /**
+ * Placeholder for {@code Connection.enquoteLiteral(String)}.
+ *
+ * @param value the string to encode.
+ * @return the quoted value.
+ */
+ public static String enquoteLiteral(String value) {
+ return '\'' + value.replace("'", "''") + '\'';
+ }
+}
(sis) 02/05: Removed the deprecated `LocalizedException` interface.
Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
asf-gitbox-commits pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git
commit 120b6be14dd92777ed95a438497a9ab628ab4f1b
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Fri Oct 16 15:46:38 2026 +0200
Removed the deprecated `LocalizedException` interface.
---
.../org/apache/sis/feature/EnvelopeOperation.java | 8 +-
.../sis/feature/FeatureOperationException.java | 46 +++++-------
.../sis/feature/InvalidFeatureException.java | 38 +++++-----
.../main/org/apache/sis/feature/package-info.java | 2 +-
.../sis/metadata/MetadataVisitorException.java | 52 +++++++++----
.../main/org/apache/sis/openoffice/CalcAddins.java | 20 +----
.../sis/io/wkt/UnparsableObjectException.java | 49 +++++++++----
.../main/org/apache/sis/io/wkt/package-info.java | 2 +-
.../org/apache/sis/storage/DataStoreException.java | 55 +++++++++-----
.../src/org.apache.sis.util/main/module-info.java | 3 +-
.../main/org/apache/sis/util/Exceptions.java | 44 ++++-------
.../org/apache/sis/util/LocalizedException.java | 85 ----------------------
.../internal/shared/LocalizedParseException.java | 38 +++++++---
.../main/org/apache/sis/util/logging/Logging.java | 4 +-
.../main/org/apache/sis/util/package-info.java | 2 +-
.../sis/util/resources/IndexedResourceBundle.java | 8 +-
.../shared/LocalizedParseExceptionTest.java | 12 +--
.../org/apache/sis/gui/referencing/WKTPane.java | 7 +-
18 files changed, 223 insertions(+), 252 deletions(-)
diff --git a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/EnvelopeOperation.java b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/EnvelopeOperation.java
index 5c2806c8ec..b3e00c8932 100644
--- a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/EnvelopeOperation.java
+++ b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/EnvelopeOperation.java
@@ -417,7 +417,7 @@ final class EnvelopeOperation extends AbstractOperation {
final Object geomCRS;
if (at != null && (geomCRS = at.getValue()) != null) {
if (!(geomCRS instanceof CoordinateReferenceSystem)) {
- throw new FeatureOperationException(Resources.formatInternational(
+ throw new FeatureOperationException(Resources.format(
Resources.Keys.IllegalCharacteristicsType_3,
AttributeConvention.CRS_CHARACTERISTIC,
CoordinateReferenceSystem.class,
@@ -443,7 +443,7 @@ final class EnvelopeOperation extends AbstractOperation {
genv = Envelopes.transform(op, genv);
}
} catch (FactoryException | TransformException e) {
- throw new FeatureOperationException(Errors.formatInternational(Errors.Keys.CanNotTransformEnvelope), e);
+ throw new FeatureOperationException(Errors.format(Errors.Keys.CanNotTransformEnvelope), e);
}
/*
* If there is only one geometry, we will return that geometry as-is even if its CRS is unknown.
@@ -454,7 +454,7 @@ final class EnvelopeOperation extends AbstractOperation {
if (envelope == null) {
envelope = genv;
} else if (hasUnknownCRS) {
- throw new FeatureOperationException(Errors.formatInternational(Errors.Keys.UnspecifiedCRS));
+ throw new FeatureOperationException(Errors.format(Errors.Keys.UnspecifiedCRS));
} else if (targetCRS != null) {
envelope.add(genv);
} else {
@@ -470,7 +470,7 @@ final class EnvelopeOperation extends AbstractOperation {
} else try {
return Envelopes.union(deferred);
} catch (TransformException e) {
- throw new FeatureOperationException(Errors.formatInternational(Errors.Keys.CanNotTransformEnvelope), e);
+ throw new FeatureOperationException(Errors.format(Errors.Keys.CanNotTransformEnvelope), e);
}
}
}
diff --git a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/FeatureOperationException.java b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/FeatureOperationException.java
index dabb75dd2d..b37deb01d7 100644
--- a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/FeatureOperationException.java
+++ b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/FeatureOperationException.java
@@ -16,58 +16,48 @@
*/
package org.apache.sis.feature;
-import org.opengis.util.InternationalString;
-import org.apache.sis.util.LocalizedException;
-
/**
* Thrown when a property value cannot be computed.
* This exception may occur during a call to {@link AbstractAttribute#getValue()} on an attribute
* instance which computes its value dynamically instead of returning a stored value.
- * It may be for example the attributes produced by {@link FeatureOperations}.
+ * It may be, for example, the attributes produced by {@link FeatureOperations}.
*
* @author Martin Desruisseaux (Geomatys)
+ * @version 1.8
+ * @since 1.8
*/
-final class FeatureOperationException extends IllegalStateException implements LocalizedException {
+public class FeatureOperationException extends IllegalStateException {
/**
* For cross-version compatibility.
*/
- private static final long serialVersionUID = -7281160433831489357L;
-
- /**
- * A description of the computation error.
- */
- @SuppressWarnings("serial") // Most SIS implementations are serializable.
- private final InternationalString message;
+ private static final long serialVersionUID = 6381299496396235246L;
/**
- * Creates a new exception with the given explanation message.
+ * Creates an exception with the specified details message.
*
- * @param message a description of the computation error.
+ * @param message the detail message in the default locale.
*/
- FeatureOperationException(final InternationalString message) {
- super(message.toString());
- this.message = message;
+ public FeatureOperationException(String message) {
+ super(message);
}
/**
- * Creates a new exception with the given explanation message and cause.
+ * Creates an exception with the specified cause and no details message.
*
- * @param message a description of the computation error.
- * @param cause the cause of the error.
+ * @param cause the cause for this exception.
*/
- FeatureOperationException(final InternationalString message, final Exception cause) {
- super(message.toString(), cause);
- this.message = message;
+ public FeatureOperationException(Throwable cause) {
+ super(cause);
}
/**
- * Returns the message in various locales.
+ * Creates an exception with the specified details message and cause.
*
- * @return the exception message.
+ * @param message the detail message in the default locale.
+ * @param cause the cause for this exception.
*/
- @Override
- public InternationalString getInternationalMessage() {
- return message;
+ public FeatureOperationException(String message, Throwable cause) {
+ super(message, cause);
}
}
diff --git a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/InvalidFeatureException.java b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/InvalidFeatureException.java
index 6aeff94a2a..4910141115 100644
--- a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/InvalidFeatureException.java
+++ b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/InvalidFeatureException.java
@@ -17,7 +17,6 @@
package org.apache.sis.feature;
import org.opengis.util.InternationalString;
-import org.apache.sis.util.LocalizedException;
// Specific to the geoapi-3.1 and geoapi-4.0 branches:
import org.opengis.feature.Feature;
@@ -27,25 +26,20 @@ import org.opengis.feature.InvalidPropertyValueException;
/**
* Thrown when a feature fails at least one conformance test.
*
- * <h2>API design note</h2>
- * This exception extends {@link InvalidPropertyValueException} because an Apache SIS feature
- * can be invalid only if a property is invalid.
+ * <p><b>API design note:</b> this exception extends {@link InvalidPropertyValueException}
+ * because an Apache <abbr>SIS</abbr> feature can be invalid only if a property is invalid.</p>
*
* @author Martin Desruisseaux (Geomatys)
+ * @version 1.8
+ * @since 1.8
*
* @see Features#validate(Feature)
*/
-final class InvalidFeatureException extends InvalidPropertyValueException implements LocalizedException {
+public class InvalidFeatureException extends InvalidPropertyValueException {
/**
* For cross-version compatibility.
*/
- private static final long serialVersionUID = 7288810679876346027L;
-
- /**
- * A description of the illegal feature.
- */
- @SuppressWarnings("serial") // Most SIS implementations are serializable.
- private final InternationalString message;
+ private static final long serialVersionUID = -8089121424988848183L;
/**
* Creates a new exception with the given explanation message.
@@ -54,16 +48,24 @@ final class InvalidFeatureException extends InvalidPropertyValueException implem
*/
InvalidFeatureException(final InternationalString message) {
super(message.toString());
- this.message = message;
}
/**
- * Returns the message in various locales.
+ * Creates an exception with the specified details message.
+ *
+ * @param message the detail message in the default locale.
+ */
+ public InvalidFeatureException(String message) {
+ super(message);
+ }
+
+ /**
+ * Creates an exception with the specified details message and cause.
*
- * @return the exception message.
+ * @param message the detail message in the default locale.
+ * @param cause the cause for this exception.
*/
- @Override
- public InternationalString getInternationalMessage() {
- return message;
+ public InvalidFeatureException(String message, Throwable cause) {
+ super(message, cause);
}
}
diff --git a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/package-info.java b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/package-info.java
index f10a0bf841..e8e9a140cf 100644
--- a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/package-info.java
+++ b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/package-info.java
@@ -93,7 +93,7 @@
* @author Travis L. Pinney
* @author Johann Sorel (Geomatys)
* @author Martin Desruisseaux (Geomatys)
- * @version 1.7
+ * @version 1.8
* @since 0.5
*/
package org.apache.sis.feature;
diff --git a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/MetadataVisitorException.java b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/MetadataVisitorException.java
index 09ead057f7..085409e7a3 100644
--- a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/MetadataVisitorException.java
+++ b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/MetadataVisitorException.java
@@ -16,8 +16,8 @@
*/
package org.apache.sis.metadata;
-import org.opengis.util.InternationalString;
-import org.apache.sis.util.LocalizedException;
+import java.util.Locale;
+import org.apache.sis.util.Localized;
import org.apache.sis.util.collection.BackingStoreException;
import org.apache.sis.util.collection.Containers;
import org.apache.sis.util.resources.Errors;
@@ -25,10 +25,12 @@ import org.apache.sis.util.resources.Errors;
/**
* Thrown when a {@link MetadataVisitor#visit(Class, Object)} method failed.
+ * The details message is created only when requested.
+ * The context-sensitive locale is inherited from the cause.
*
* @author Martin Desruisseaux (Geomatys)
*/
-final class MetadataVisitorException extends BackingStoreException implements LocalizedException {
+final class MetadataVisitorException extends BackingStoreException implements Localized {
/**
* For cross-version compatibility.
*/
@@ -53,17 +55,31 @@ final class MetadataVisitorException extends BackingStoreException implements Lo
/**
* Returns an error message giving the location of the failure together with the cause.
+ *
+ * @return the detail message in the default locale.
*/
@Override
public String getMessage() {
- return getInternationalMessage().toString();
+ return getMessage(false);
}
/**
- * Returns an error message giving the location of the failure together with the cause.
+ * Returns an error message in a context-dependent locale if available.
+ *
+ * @return the detail message in the context-dependent locale.
*/
@Override
- public InternationalString getInternationalMessage() {
+ public String getLocalizedMessage() {
+ return getMessage(true);
+ }
+
+ /**
+ * Returns an error message giving the location of the failure together with the cause.
+ *
+ * @param localized whether to use context-dependent locale.
+ * @return the detail message in the given locale.
+ */
+ private String getMessage(final boolean localized) {
short key = Errors.Keys.CanNotProcessProperty_2;
int count = 2;
String location = super.getMessage();
@@ -76,15 +92,9 @@ final class MetadataVisitorException extends BackingStoreException implements Lo
}
}
final Throwable cause = getCause();
- Object message = null;
- if (cause instanceof LocalizedException) {
- message = ((LocalizedException) cause).getInternationalMessage();
- }
+ Object message = localized ? cause.getLocalizedMessage() : cause.getMessage();
if (message == null) {
- message = cause.getLocalizedMessage();
- if (message == null) {
- message = cause.getClass();
- }
+ message = cause.getClass();
}
final var arguments = new Object[count];
arguments[--count] = message;
@@ -92,6 +102,18 @@ final class MetadataVisitorException extends BackingStoreException implements Lo
if (count != 0) {
arguments[0] = String.join(".", Containers.viewAsUnmodifiableList(propertyPath, 0, pathLength));
}
- return Errors.formatInternational(key, arguments);
+ return Errors.forLocale(getLocale()).getString(key, arguments);
+ }
+
+ /**
+ * Returns the locale of the localized exception message, or {@code null} if unspecified.
+ * If non-null, this is the effective language of the string returned by {@link #getLocalizedMessage()}.
+ *
+ * @return the locale of the localized message, or {@code null} if not explicitly defined.
+ */
+ @Override
+ public Locale getLocale() {
+ final Throwable cause = getCause();
+ return (cause instanceof Localized) ? ((Localized) cause).getLocale() : null;
}
}
diff --git a/endorsed/src/org.apache.sis.openoffice/main/org/apache/sis/openoffice/CalcAddins.java b/endorsed/src/org.apache.sis.openoffice/main/org/apache/sis/openoffice/CalcAddins.java
index d597cf0335..345eed443b 100644
--- a/endorsed/src/org.apache.sis.openoffice/main/org/apache/sis/openoffice/CalcAddins.java
+++ b/endorsed/src/org.apache.sis.openoffice/main/org/apache/sis/openoffice/CalcAddins.java
@@ -25,6 +25,7 @@ import com.sun.star.lang.XServiceInfo;
import com.sun.star.lang.XServiceName;
import com.sun.star.uno.XComponentContext;
import com.sun.star.lib.uno.helper.WeakBase;
+import org.apache.sis.pending.jdk.JDK19;
import org.apache.sis.util.Classes;
import org.apache.sis.util.Exceptions;
import org.apache.sis.util.resources.Vocabulary;
@@ -133,7 +134,7 @@ public abstract class CalcAddins extends WeakBase implements XServiceName, XServ
String language = locale.Language; if (language == null) language = "";
String country = locale.Country; if (country == null) country = "";
String variant = locale.Variant; if (variant == null) variant = "";
- javaLocale = new java.util.Locale(language, country, variant);
+ javaLocale = JDK19.localeOf(language, country, variant);
} else {
javaLocale = java.util.Locale.getDefault();
}
@@ -150,20 +151,6 @@ public abstract class CalcAddins extends WeakBase implements XServiceName, XServ
return Vocabulary.forLocale(getJavaLocale()).getString(Vocabulary.Keys.NotKnown);
}
- /**
- * Returns the minimal length of the specified arrays. In the special case where one array
- * has a length of 1, we assume that this single element will be repeated for all elements
- * in the other array.
- */
- static int getMinimalLength(final Object[] array1, final Object[] array2) {
- if (array1 == null || array2 == null) {
- return 0;
- }
- if (array1.length == 1) return array2.length;
- if (array2.length == 1) return array1.length;
- return Math.min(array1.length, array2.length);
- }
-
/**
* Returns the localized message from the specified exception. If no message is available,
* returns a default string. This method never return a null value.
@@ -187,8 +174,9 @@ public abstract class CalcAddins extends WeakBase implements XServiceName, XServ
* @param exception the exception.
*/
final void reportException(final String method, final Exception exception) {
+ @SuppressWarnings("LocalVariableHidesMemberVariable")
final Logger logger = getLogger();
- final LogRecord record = new LogRecord(Level.WARNING, getLocalizedMessage(exception));
+ final var record = new LogRecord(Level.WARNING, getLocalizedMessage(exception));
record.setLoggerName(logger.getName());
record.setSourceClassName(getClass().getCanonicalName());
record.setSourceMethodName(method);
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/io/wkt/UnparsableObjectException.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/io/wkt/UnparsableObjectException.java
index bf90aeae0c..971e019691 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/io/wkt/UnparsableObjectException.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/io/wkt/UnparsableObjectException.java
@@ -18,15 +18,13 @@ package org.apache.sis.io.wkt;
import java.util.Locale;
import java.text.ParseException;
-import org.opengis.util.InternationalString;
-import org.apache.sis.util.LocalizedException;
+import org.apache.sis.util.Localized;
+import org.apache.sis.util.Workaround;
import org.apache.sis.util.resources.Errors;
/**
- * Thrown when a <i>Well Known Text</i> (WKT) cannot be parsed.
- *
- * <h2>Localization</h2>
+ * Thrown when a <i>Well Known Text</i> (<abbr>WKT</abbr>) cannot be parsed.
* This exception may contain the error message in two languages:
*
* <ul>
@@ -38,15 +36,25 @@ import org.apache.sis.util.resources.Errors;
* </ul>
*
* @author Martin Desruisseaux (Geomatys)
- * @version 0.8
+ * @version 1.8
* @since 0.8
*/
-public class UnparsableObjectException extends ParseException implements LocalizedException {
+public class UnparsableObjectException extends ParseException implements Localized {
/**
* For cross-version compatibility.
*/
private static final long serialVersionUID = 5949195205739826024L;
+ /**
+ * The effective locale of the localized message, or {@code null} if unspecified.
+ * This is the locale of the message returned by {@link #getLocalizedMessage()}.
+ * It is specified at construction time, then eventually replaced by the locale
+ * of the resource used for building the message.
+ *
+ * @see #getLocale()
+ */
+ private Locale locale;
+
/**
* The resources key as one of the {@link Errors.Keys} constant, or 0 if none.
*
@@ -80,9 +88,18 @@ public class UnparsableObjectException extends ParseException implements Localiz
* @param errorOffset the position where the error is found while parsing.
*/
UnparsableObjectException(final Locale locale, final short key, final Object[] parameters, final int errorOffset) {
- super(Errors.forLocale(locale).getString(key, parameters), errorOffset);
- this.parameters = parameters;
+ this(Errors.forLocale(locale), key, parameters, errorOffset);
+ }
+
+ /**
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
+ */
+ @Workaround(library="JDK", version="11", fixed="25")
+ private UnparsableObjectException(final Errors resources, final short key, final Object[] parameters, final int errorOffset) {
+ super(resources.getString(key, parameters), errorOffset);
+ this.locale = resources.getLocale();
this.key = key;
+ this.parameters = parameters;
}
/**
@@ -110,14 +127,18 @@ public class UnparsableObjectException extends ParseException implements Localiz
}
/**
- * If this exception is capable to return the message in various locales, returns that message.
- * Otherwise returns {@code null}.
+ * Returns the locale of the localized exception message, or {@code null} if unspecified.
+ * If non-null, this is the effective language of the string returned by {@link #getLocalizedMessage()}.
+ * This locale depends on the {@linkplain WKTFormat#getLocale() locale configured on the WKT parser} and
+ * the resources available in Apache <abbr>SIS</abbr>.
+ *
+ * @return the locale of the localized message, or {@code null} if not explicitly defined.
*
- * @return the exception message, or {@code null} if this exception cannot produce international message.
+ * @since 1.8
*/
@Override
- public InternationalString getInternationalMessage() {
- return (key != 0) ? Errors.formatInternational(key, parameters) : null;
+ public Locale getLocale() {
+ return locale;
}
/**
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/io/wkt/package-info.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/io/wkt/package-info.java
index e53edbfd09..f6dcb9bb84 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/io/wkt/package-info.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/io/wkt/package-info.java
@@ -82,7 +82,7 @@
* @author Martin Desruisseaux (IRD, Geomatys)
* @author Rémi Eve (IRD)
* @author Rueben Schulz (UBC)
- * @version 1.7
+ * @version 1.8
* @since 0.4
*/
package org.apache.sis.io.wkt;
diff --git a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/DataStoreException.java b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/DataStoreException.java
index ad301679ed..d4f5686c7d 100644
--- a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/DataStoreException.java
+++ b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/DataStoreException.java
@@ -17,8 +17,7 @@
package org.apache.sis.storage;
import java.util.Locale;
-import org.opengis.util.InternationalString;
-import org.apache.sis.util.LocalizedException;
+import org.apache.sis.util.Localized;
import org.apache.sis.util.Workaround;
import org.apache.sis.storage.internal.Resources;
import org.apache.sis.io.stream.IOUtilities;
@@ -27,26 +26,35 @@ import org.apache.sis.io.stream.IOUtilities;
/**
* Thrown when a {@link DataStore} cannot complete a read or write operation.
*
- * <h2>Localization</h2>
- * The {@link #getMessage()} and {@link #getLocalizedMessage()} methods return the same message,
- * but sometimes in different languages. The general policy is that {@link #getMessage()} returns
- * the message in the JVM {@linkplain Locale#getDefault() default locale} while {@link #getLocalizedMessage()}
- * returns the message in the locale specified by the last call to {@link DataStore#setLocale(Locale)}.
+ * <p><b>Localization:</b>
+ * The exception {@linkplain #getMessage() message} is usually in a language
+ * determined by the <abbr>JVM</abbr>-wide {@linkplain Locale#getDefault() default locale}.
+ * In addition, a {@linkplain #getLocalizedMessage() localized message} may also be available in a
+ * language determined by the {@linkplain DataStore#getLocale() locale configured on the data store}.
* In a client-server architecture, the former is typically the locale of the system administrator
- * while the latter is presumably the locale of the client connected to the server.
- * However, this policy is applied on a <em>best-effort</em> basis only.
+ * while the latter should be the locale of the client connected to the server.</p>
*
* @author Johann Sorel (Geomatys)
* @author Martin Desruisseaux (Geomatys)
- * @version 0.8
+ * @version 1.8
* @since 0.3
*/
-public class DataStoreException extends Exception implements LocalizedException {
+public class DataStoreException extends Exception implements Localized {
/**
* For cross-version compatibility.
*/
private static final long serialVersionUID = -1778987176103191950L;
+ /**
+ * The effective locale of the localized message, or {@code null} if unspecified.
+ * This is the locale of the message returned by {@link #getLocalizedMessage()}.
+ * It is specified at construction time, then eventually replaced by the locale
+ * of the resource used for building the message.
+ *
+ * @see #getLocale()
+ */
+ private Locale locale;
+
/**
* The resources key as one of the {@link Resources.Keys} constant, or 0 if none.
*
@@ -137,7 +145,16 @@ public class DataStoreException extends Exception implements LocalizedException
* @param parameters parameters to use for formatting the messages.
*/
DataStoreException(final Locale locale, final short key, final Object... parameters) {
- super(Resources.forLocale(locale).getString(key, parameters));
+ this(Resources.forLocale(locale), key, parameters);
+ }
+
+ /**
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
+ */
+ @Workaround(library="JDK", version="11", fixed="25")
+ private DataStoreException(final Resources resources, final short key, final Object[] parameters) {
+ super(resources.getString(key, parameters));
+ this.locale = resources.getLocale();
this.key = key;
this.parameters = parameters;
}
@@ -179,16 +196,18 @@ public class DataStoreException extends Exception implements LocalizedException
}
/**
- * If this exception is capable to return the message in various locales, returns that message.
- * Otherwise returns {@code null}.
+ * Returns the locale of the localized exception message, or {@code null} if unspecified.
+ * If non-null, this is the effective language of the string returned by {@link #getLocalizedMessage()}.
+ * This locale depends on the {@linkplain DataStore#getLocale() locale configured on the data store} and
+ * the resources available in Apache <abbr>SIS</abbr>.
*
- * @return the exception message, or {@code null} if this exception cannot produce international message.
+ * @return the locale of the localized message, or {@code null} if not explicitly defined.
*
- * @since 0.8
+ * @since 1.8
*/
@Override
- public InternationalString getInternationalMessage() {
- return (key != 0) ? Resources.formatInternational(key, parameters) : null;
+ public Locale getLocale() {
+ return locale;
}
/**
diff --git a/endorsed/src/org.apache.sis.util/main/module-info.java b/endorsed/src/org.apache.sis.util/main/module-info.java
index aee6c12b11..f69aa636f4 100644
--- a/endorsed/src/org.apache.sis.util/main/module-info.java
+++ b/endorsed/src/org.apache.sis.util/main/module-info.java
@@ -22,7 +22,7 @@
*
* @author Martin Desruisseaux (MPO, IRD, Geomatys)
* @author Alexis Manin (Geomatys)
- * @version 1.7
+ * @version 1.8
* @since 0.3
*/
module org.apache.sis.util {
@@ -178,6 +178,7 @@ module org.apache.sis.util {
org.apache.sis.storage.netcdf,
org.apache.sis.storage.geoheif,
org.apache.sis.storage.geotiff,
+ org.apache.sis.openoffice,
org.apache.sis.console,
org.apache.sis.portrayal,
org.apache.sis.gui; // In the "optional" sub-project.
diff --git a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/Exceptions.java b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/Exceptions.java
index e0826556a6..d792d9fd04 100644
--- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/Exceptions.java
+++ b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/Exceptions.java
@@ -25,7 +25,6 @@ import java.io.UncheckedIOException;
import java.nio.file.DirectoryIteratorException;
import java.lang.reflect.InvocationTargetException;
import java.util.concurrent.ExecutionException;
-import org.opengis.util.InternationalString;
import org.apache.sis.util.resources.Vocabulary;
import org.apache.sis.util.collection.BackingStoreException;
@@ -51,7 +50,7 @@ import org.apache.sis.util.collection.BackingStoreException;
* This allows system administrator to analyze the issue without the need to understand client's language.</p>
*
* @author Martin Desruisseaux (IRD, Geomatys)
- * @version 1.7
+ * @version 1.8
* @since 0.3
*/
public final class Exceptions {
@@ -62,47 +61,36 @@ public final class Exceptions {
}
/**
- * Returns the message of the given exception, localized in the given locale if possible.
- * Some exceptions created by SIS can format a message in different locales. This method
- * returns such localized message if possible, or fallback on the standard JDK methods otherwise.
- * More specifically:
+ * Returns the message of the given exception with a preference for the given locale.
+ * The heuristic rules applied by this method may change between different versions of
+ * Apache <abbr>SIS</abbr>. The current rules are:
*
* <ul>
- * <li>If the given {@code exception} is null, then this method returns {@code null}.</li>
- * <li>Otherwise if the given {@code locale} is null, then this method returns {@link Exception#getMessage()}.
- * This is consistent with the {@link Localized} policy saying that null locale stands for "unlocalized"
- * message (usually in English) or message in the JVM {@linkplain Locale#getDefault() default locale}.</li>
- * <li>Otherwise if the given {@code exception} is an instance of {@link LocalizedException} providing
- * a non-null {@linkplain LocalizedException#getInternationalMessage() international message},
- * then this method returns the result of {@link InternationalString#toString(Locale)}.</li>
- * <li>Otherwise this method returns {@link Exception#getLocalizedMessage()}.</li>
+ * <li>If the given {@code exception} is null, returns {@code null}.</li>
+ * <li>If the given {@code locale} is null, returns {@link Exception#getMessage()}.</li>
+ * <li>If the given {@code exception} does <em>not</em> implement {@link Localized},
+ * returns {@link Exception#getLocalizedMessage()}.</li>
+ * <li>Otherwise, this method compares {@link Localized#getLocale()} with the given locale
+ * for choosing between {@code getMessage()} and {@code getLocalizedMessage()}.</li>
* </ul>
*
* @param exception the exception from which to get the localize message, or {@code null}.
- * @param locale the preferred locale for the message, or {@code null} for the JVM default locale.
+ * @param locale the preferred locale for the message, or {@code null} if unspecified.
* This locale is honored on a <em>best effort</em> basis only.
* @return the message in the given locale if possible, or {@code null} if the {@code exception}
* argument was {@code null} or if the exception does not contain a message.
- *
- * @see LocalizedException#getLocalizedMessage()
- *
- * @deprecated Depends on {@link LocalizedException}, which has been deprecated.
*/
- @Deprecated(since = "1.7", forRemoval = true)
public static String getLocalizedMessage(final Throwable exception, final Locale locale) {
if (exception == null) {
return null;
}
if (locale == null) {
- return exception.getMessage(); // See the policy documented in LocalizedException.getMessage()
+ return exception.getMessage();
}
- if (exception instanceof LocalizedException) {
- final InternationalString i18n = ((LocalizedException) exception).getInternationalMessage();
- if (i18n != null) {
- final String message = i18n.toString(locale);
- if (message != null) {
- return message;
- }
+ if (exception instanceof Localized) {
+ final Locale actual = ((Localized) exception).getLocale();
+ if (actual != null && !locale.getLanguage().equalsIgnoreCase(actual.getLanguage())) {
+ return exception.getMessage();
}
}
return exception.getLocalizedMessage();
diff --git a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/LocalizedException.java b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/LocalizedException.java
deleted file mode 100644
index 1f5c1a35cb..0000000000
--- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/LocalizedException.java
+++ /dev/null
@@ -1,85 +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.util;
-
-import java.util.Locale;
-import org.opengis.util.InternationalString;
-
-
-/**
- * An exception which can produce an error message in the client locale.
- * Exceptions implementing this interface apply the following policy:
- *
- * <ul>
- * <li>{@link #getMessage()} returns the message in the {@linkplain Locale#getDefault() default locale}.
- * In a client-server architecture, this is often the locale on the server side.</li>
- * <li>{@link #getLocalizedMessage()} returns the message in a locale that depends on the context
- * in which the exception has been thrown. This is often the locale used by a {@link java.text.Format}
- * or {@link org.apache.sis.storage.DataStore} instance,
- * and can be presumed to be the locale on the client side.</li>
- * <li>{@link #getInternationalMessage()} may return the message in arbitrary locale (optional operation).
- * This method is specific to Apache SIS.</li>
- * </ul>
- *
- * <h2>Example</h2>
- * If an error occurred while a Japanese client connected to an European server, the localized message may be sent
- * to the client in Japanese language while the same error may be logged on the server side in the French language.
- * This allows system administrator to analyze the issue without the need to understand client's language.
- *
- * The above policy is applied on a <em>best-effort</em> basis only. For example, exceptions that
- * do not implement {@code LocalizedException} may use any locale (not necessarily the default one),
- * and {@code LocalizedException} used as {@linkplain Exception#Exception(Throwable) wrappers} around
- * other exception usually lost their localization capability.
- *
- * @author Martin Desruisseaux (Geomatys)
- * @version 1.7
- *
- * @see Exceptions#getLocalizedMessage(Throwable, Locale)
- * @see org.apache.sis.storage.DataStore#setLocale(Locale)
- *
- * @since 0.8
- *
- * @deprecated Rarely used in practice and support is unequal.
- */
-@Deprecated(since = "1.7", forRemoval = true)
-public interface LocalizedException {
- /**
- * Returns the message in the {@linkplain Locale#getDefault() default locale}.
- * In a client-server architecture, this is usually the locale on the server side.
- * This is the recommended language for logging messages to be read by system administrators.
- *
- * @return the exception message in the JVM {@linkplain Locale#getDefault() default locale}.
- */
- String getMessage();
-
- /**
- * Returns the message in the locale that depends on the context in which this exception has been thrown.
- * For example, it may be the local of a client application connected to a distant server.
- * This is the recommended language to show in widgets.
- *
- * @return the exception message in the locale of a service configured for a particular client.
- */
- String getLocalizedMessage();
-
- /**
- * If this exception is capable to return the message in various locales, returns that message.
- * Otherwise returns {@code null}.
- *
- * @return the exception message, or {@code null} if this exception cannot produce international message.
- */
- InternationalString getInternationalMessage();
-}
diff --git a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/internal/shared/LocalizedParseException.java b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/internal/shared/LocalizedParseException.java
index 7f7cc74cc0..9eea5a2057 100644
--- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/internal/shared/LocalizedParseException.java
+++ b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/internal/shared/LocalizedParseException.java
@@ -19,10 +19,9 @@ package org.apache.sis.util.internal.shared;
import java.util.Locale;
import java.text.ParsePosition;
import java.text.ParseException;
-import org.opengis.util.InternationalString;
import org.apache.sis.util.Workaround;
import org.apache.sis.util.CharSequences;
-import org.apache.sis.util.LocalizedException;
+import org.apache.sis.util.Localized;
import org.apache.sis.util.resources.Errors;
@@ -41,12 +40,22 @@ import org.apache.sis.util.resources.Errors;
*
* @author Martin Desruisseaux (Geomatys)
*/
-public final class LocalizedParseException extends ParseException implements LocalizedException {
+public final class LocalizedParseException extends ParseException implements Localized {
/**
* For cross-version compatibility.
*/
private static final long serialVersionUID = -1467571540435486742L;
+ /**
+ * The effective locale of the localized message, or {@code null} if unspecified.
+ * This is the locale of the message returned by {@link #getLocalizedMessage()}.
+ * It is specified at construction time, then eventually replaced by the locale
+ * of the resource used for building the message.
+ *
+ * @see #getLocale()
+ */
+ private final Locale locale;
+
/**
* The resources key as one of the {@link Errors.Keys} constant, or 0 if none.
*
@@ -71,7 +80,16 @@ public final class LocalizedParseException extends ParseException implements Loc
* @param errorOffset the position where the error is found while parsing.
*/
public LocalizedParseException(final Locale locale, final short key, final Object[] parameters, final int errorOffset) {
- super(Errors.forLocale(locale).getString(key, parameters), errorOffset);
+ this(Errors.forLocale(locale), key, parameters, errorOffset);
+ }
+
+ /**
+ * Workaround while waiting for JEP 513: Flexible Constructor Bodies.
+ */
+ @Workaround(library="JDK", version="11", fixed="25")
+ private LocalizedParseException(final Errors resources, final short key, final Object[] parameters, final int errorOffset) {
+ super(resources.getString(key, parameters), errorOffset);
+ this.locale = resources.getLocale();
this.parameters = parameters;
this.key = key;
}
@@ -168,14 +186,16 @@ public final class LocalizedParseException extends ParseException implements Loc
}
/**
- * If this exception is capable to return the message in various locales, returns that message.
- * Otherwise returns {@code null}.
+ * Returns the locale of the localized exception message, or {@code null} if unspecified.
+ * If non-null, this is the effective language of the string returned by {@link #getLocalizedMessage()}.
+ *
+ * @return the locale of the localized message, or {@code null} if not explicitly defined.
*
- * @return the exception message, or {@code null} if this exception cannot produce international message.
+ * @since 1.8
*/
@Override
- public InternationalString getInternationalMessage() {
- return (key != 0) ? Errors.formatInternational(key, parameters) : null;
+ public Locale getLocale() {
+ return locale;
}
/**
diff --git a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/logging/Logging.java b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/logging/Logging.java
index f9e9d5f6f1..9ef85b274d 100644
--- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/logging/Logging.java
+++ b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/logging/Logging.java
@@ -269,9 +269,9 @@ public final class Logging {
/*
* The message is fetched using Exception.getMessage() instead of getLocalizedMessage()
* because in a client-server architecture, we want the locale on the server-side instead
- * than the locale on the client side. See LocalizedException policy.
+ * than the locale on the client side. See the policy documented in the `Exceptions` class.
*/
- final StringBuilder buffer = new StringBuilder(256).append(Classes.getShortClassName(error));
+ final var buffer = new StringBuilder(256).append(Classes.getShortClassName(error));
String message = error.getMessage(); // Targeted to system administrators (see above).
if (message != null) {
buffer.append(": ").append(message);
diff --git a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/package-info.java b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/package-info.java
index 28291f7284..a0e0b8af13 100644
--- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/package-info.java
+++ b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/package-info.java
@@ -39,7 +39,7 @@
*
* @author Martin Desruisseaux (Geomatys)
* @author Alexis Manin (Geomatys)
- * @version 1.7
+ * @version 1.8
* @since 0.3
*/
package org.apache.sis.util;
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 998e711792..106a6cfa8e 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
@@ -294,7 +294,7 @@ public abstract class IndexedResourceBundle extends ResourceBundle implements Lo
/*
* Loads resources from the UTF file.
*/
- try (DataInputStream input = new DataInputStream(new BufferedInputStream(resources))) {
+ try (var input = new DataInputStream(new BufferedInputStream(resources))) {
values = new String[input.readInt()];
for (int i=0; i<values.length; i++) {
values[i] = input.readUTF();
@@ -307,9 +307,11 @@ public abstract class IndexedResourceBundle extends ResourceBundle implements Lo
record.setMessage(exception.getMessage()); // For administrator, use system locale.
record.setThrown (exception);
Logging.completeAndLog(LOGGER, IndexedResourceBundle.class, methodName, record);
- throw (MissingResourceException) new MissingResourceException(
+ var e = new MissingResourceException(
Exceptions.getLocalizedMessage(exception, locale), // For users, use requested locale.
- baseName, key).initCause(exception);
+ baseName, key);
+ e.initCause(exception);
+ throw e;
}
/*
* Now, logs the message. This message is provided only in English.
diff --git a/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/internal/shared/LocalizedParseExceptionTest.java b/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/internal/shared/LocalizedParseExceptionTest.java
index 32ae104b0a..3ba1de9a6d 100644
--- a/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/internal/shared/LocalizedParseExceptionTest.java
+++ b/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/internal/shared/LocalizedParseExceptionTest.java
@@ -50,16 +50,18 @@ public final class LocalizedParseExceptionTest extends TestCase {
final var pos = new ParsePosition(0);
pos.setErrorIndex(5);
final var e = new LocalizedParseException(Locale.CANADA, Angle.class, "Some text to parse", pos);
- String message = e.getLocalizedMessage();
+ final String message = e.getLocalizedMessage();
assertTrue(message.contains("Some text to parse"), message);
assertTrue(message.contains("cannot be parsed"), message);
assertTrue(message.contains("Angle"), message);
assertEquals(message, Exceptions.getLocalizedMessage(e, Locale.CANADA));
- message = Exceptions.getLocalizedMessage(e, Locale.FRANCE);
- assertTrue(message.contains("Some text to parse"), message);
- assertTrue(message.contains("n’est pas reconnu"), message);
- assertTrue(message.contains("Angle"), message);
+ final String localized = Exceptions.getLocalizedMessage(e, Locale.FRANCE);
+ if (!localized.equals(message)) { // Locale-dependent test.
+ assertTrue(localized.contains("Some text to parse"), localized);
+ assertTrue(localized.contains("n’est pas reconnu"), localized);
+ assertTrue(localized.contains("Angle"), localized);
+ }
}
/**
diff --git a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/referencing/WKTPane.java b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/referencing/WKTPane.java
index 98cd70a217..49d650150a 100644
--- a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/referencing/WKTPane.java
+++ b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/referencing/WKTPane.java
@@ -72,6 +72,7 @@ final class WKTPane extends StringConverter<Convention> implements ChangeListene
/**
* Creates a new pane for showing CRS Well Known Text.
*/
+ @SuppressWarnings("LeakingThisInConstructor")
WKTPane(final Locale locale) {
final Convention[] sc = { // Selected conventions in the order we want them to appear.
Convention.WKT2_SIMPLIFIED,
@@ -110,11 +111,11 @@ final class WKTPane extends StringConverter<Convention> implements ChangeListene
case WKT1_COMMON_UNITS: version = "GDAL 1-2"; break;
default: return c.name();
}
- String text = vocabulary.getString(Vocabulary.Keys.Version_2, "WKT (Well Known Text)", version);
+ String label = vocabulary.getString(Vocabulary.Keys.Version_2, "WKT (Well Known Text)", version);
if (simplified) {
- text += " — " + vocabulary.getString(Vocabulary.Keys.Simplified);
+ label += " — " + vocabulary.getString(Vocabulary.Keys.Simplified);
}
- return text;
+ return label;
}
/**