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 0a8a45bc102ae241b053fa76576d0e899960318f Author: Martin Desruisseaux <[email protected]> AuthorDate: Wed Aug 19 17:42:13 2026 +0200 Fix or adjust a few compiler warnings (no change in the code). --- .../main/org/apache/sis/image/ComputedTiles.java | 2 +- .../main/org/apache/sis/util/iso/DefaultRecordType.java | 2 ++ .../main/org/apache/sis/util/iso/DefaultTypeName.java | 1 + .../operation/transform/MolodenskyTransform.java | 3 ++- .../main/org/apache/sis/io/stream/ChannelDataInput.java | 1 + .../test/org/apache/sis/util/collection/CacheTest.java | 16 +++++++++------- .../org/apache/sis/gui/coverage/IsolineController.java | 2 +- .../org/apache/sis/gui/coverage/TileMatrixSetPane.java | 1 - .../main/org/apache/sis/gui/dataset/FeatureTable.java | 1 - .../org/apache/sis/gui/dataset/ResourceExplorer.java | 1 - .../main/org/apache/sis/storage/gdal/GDALStore.java | 2 +- 11 files changed, 18 insertions(+), 14 deletions(-) diff --git a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/image/ComputedTiles.java b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/image/ComputedTiles.java index 3ce37922e1..4eb8f79758 100644 --- a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/image/ComputedTiles.java +++ b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/image/ComputedTiles.java @@ -83,7 +83,7 @@ final class ComputedTiles extends WeakReference<ComputedImage> implements Dispos * @param image the image for which to release tiles on garbage-collection. * @param ws sources to observe for changes, or {@code null} if none. */ - @SuppressWarnings("this-escape") + @SuppressWarnings("LeakingThisInConstructor") ComputedTiles(final ComputedImage image, final WritableRenderedImage[] ws) { super(image, ReferenceQueueConsumer.QUEUE); cachedTiles = new HashMap<>(); diff --git a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/util/iso/DefaultRecordType.java b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/util/iso/DefaultRecordType.java index f83a933802..55fe192b7d 100644 --- a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/util/iso/DefaultRecordType.java +++ b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/util/iso/DefaultRecordType.java @@ -464,6 +464,8 @@ public class DefaultRecordType extends RecordDefinition implements RecordType, S /** * Returns a hash code value for this {@code RecordType}. + * + * @return a hash code value. */ @Override public int hashCode() { diff --git a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/util/iso/DefaultTypeName.java b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/util/iso/DefaultTypeName.java index 38350caa01..37fe671a5f 100644 --- a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/util/iso/DefaultTypeName.java +++ b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/util/iso/DefaultTypeName.java @@ -143,6 +143,7 @@ import org.apache.sis.util.resources.Errors; */ @XmlType(name = "TypeName_Type") @XmlRootElement(name = "TypeName") +@SuppressWarnings("EqualsAndHashcode") public class DefaultTypeName extends DefaultLocalName implements TypeName { /** * Serial number for inter-operability with different versions. diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/transform/MolodenskyTransform.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/transform/MolodenskyTransform.java index 80672d0df5..b28f400829 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/transform/MolodenskyTransform.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/transform/MolodenskyTransform.java @@ -276,6 +276,7 @@ public class MolodenskyTransform extends DatumShiftTransform { * @param isTarget3D {@code true} if the new target coordinates shall have a height. * @param createInverse whether to invoke {@link #redimension} for creating the inverse. */ + @SuppressWarnings("LeakingThisInConstructor") private MolodenskyTransform(final MolodenskyTransform other, final boolean isSource3D, final boolean isTarget3D, final boolean createInverse) { @@ -505,7 +506,7 @@ public class MolodenskyTransform extends DatumShiftTransform { * Transforms the (λ,φ) or (λ,φ,<var>h</var>) coordinates between two geographic CRS, * and optionally returns the derivative at that location. * - * @param dstPts the array into which the transformed coordinate is returned, or {@code null}. + * @param srcPts the array containing the source coordinates (cannot be {@code null}). * @param srcOff the offset to the point to be transformed in the source array. * @param dstPts the array into which the transformed coordinates is returned. * @param dstOff the offset to the location of the transformed point that is stored in the destination array. diff --git a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/io/stream/ChannelDataInput.java b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/io/stream/ChannelDataInput.java index 53999a9f56..a07aacff72 100644 --- a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/io/stream/ChannelDataInput.java +++ b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/io/stream/ChannelDataInput.java @@ -1287,6 +1287,7 @@ loop: while (hasRemaining()) { * position is valid for the new channel position. * * @param takeOver the {@link ChannelDataOutput} which will continue operations after this instance. + * @throws IOException if an error occurred while reading or writing bytes. * * @see ChannelDataOutput#ChannelDataOutput(ChannelDataInput) */ diff --git a/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/collection/CacheTest.java b/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/collection/CacheTest.java index 84b3d4d2a3..d05930f670 100644 --- a/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/collection/CacheTest.java +++ b/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/collection/CacheTest.java @@ -86,7 +86,7 @@ public final class CacheTest extends TestCaseWithGC { public void testPutAndUnlock() { final String key = "The key"; final String value = "The value"; - final Cache<String,String> cache = new Cache<>(); + final var cache = new Cache<String, String>(); assertTrue(cache.isEmpty(), "No initial value expected."); assertNull(cache.peek(key), "No initial value expected."); @@ -107,12 +107,13 @@ public final class CacheTest extends TestCaseWithGC { * @throws InterruptedException if the test has been interrupted. */ @Test + @SuppressWarnings("UseSpecificCatch") public void testThreadBlocking() throws InterruptedException { final String keyByMainThread = "keyByMainThread"; final String valueByMainThread = "valueByMainThread"; final String keyByOtherThread = "keyByOtherThread"; final String valueByOtherThread = "valueByOtherThread"; - final Cache<String,String> cache = new Cache<>(); + final var cache = new Cache<String, String>(); final class OtherThread extends Thread { /** * If an error occurred, the cause. It may be an {@link AssertionError}. @@ -133,7 +134,7 @@ public final class CacheTest extends TestCaseWithGC { @Override public void run() { try { final Cache.Handler<String> handler = cache.lock(keyByMainThread); - assertTrue(handler instanceof Cache<?,?>.Work.Wait); + assertInstanceOf(Cache.Work.Wait.class, handler); assertSame(valueByMainThread, handler.peek()); handler.putAndUnlock(valueByMainThread); assertSame(valueByMainThread, cache.peek(keyByMainThread)); @@ -142,7 +143,7 @@ public final class CacheTest extends TestCaseWithGC { } try { final Cache.Handler<String> handler = cache.lock(keyByOtherThread); - assertTrue(handler instanceof Cache<?,?>.Work); + assertInstanceOf(Cache.Work.class, handler); assertNull(handler.peek()); handler.putAndUnlock(valueByOtherThread); assertSame(valueByOtherThread, cache.peek(keyByOtherThread)); @@ -160,8 +161,8 @@ public final class CacheTest extends TestCaseWithGC { * a value for the same key. The second thread shall block. */ final Cache.Handler<String> handler = cache.lock(keyByMainThread); - assertTrue(handler instanceof Cache<?,?>.Work); - final OtherThread thread = new OtherThread(); + assertInstanceOf(Cache.Work.class, handler); + final var thread = new OtherThread(); thread.start(); waitForBlockedState(thread); assertNull(cache.peek(keyByOtherThread), "The blocked thread shall not have added a value."); @@ -204,7 +205,7 @@ public final class CacheTest extends TestCaseWithGC { */ private static Statistics validateStressEntries(final String name, final Map<Integer,IntObject> cache) { final var statistics = new Statistics(name); - for (final Map.Entry<Integer,IntObject> entry : cache.entrySet()) { + for (final Map.Entry<Integer, IntObject> entry : cache.entrySet()) { final int key = entry.getKey(); final IntObject value = entry.getValue(); assertEquals(key*key, value.value); @@ -222,6 +223,7 @@ public final class CacheTest extends TestCaseWithGC { @Test @Benchmark @Tag(Benchmark.TAG) + @SuppressWarnings({"UseSpecificCatch", "SleepWhileInLoop"}) public void stress() throws InterruptedException { final int count = 5000; final var cache = new Cache<Integer, IntObject>(); diff --git a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/coverage/IsolineController.java b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/coverage/IsolineController.java index fbecd75e17..295f4ee153 100644 --- a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/coverage/IsolineController.java +++ b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/coverage/IsolineController.java @@ -189,7 +189,7 @@ final class IsolineController extends ItemController { * * @param steps the list of isoline levels to render. */ - @SuppressWarnings("this-escape") + @SuppressWarnings("LeakingThisInConstructor") Band(final ObservableList<Step> steps) { this.steps = steps; addListeners(steps); diff --git a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/coverage/TileMatrixSetPane.java b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/coverage/TileMatrixSetPane.java index 1eddb69e74..aa280e2e47 100644 --- a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/coverage/TileMatrixSetPane.java +++ b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/coverage/TileMatrixSetPane.java @@ -183,7 +183,6 @@ public class TileMatrixSetPane extends Widget { /** * Creates a new row for the given properties at the specified row index. */ - @SuppressWarnings("this-escape") Row(final int row, final String[] identifiers, final String[][] resolutions, diff --git a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/dataset/FeatureTable.java b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/dataset/FeatureTable.java index 4bb0f17dc1..0113eade37 100644 --- a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/dataset/FeatureTable.java +++ b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/dataset/FeatureTable.java @@ -106,7 +106,6 @@ public class FeatureTable extends TableView<Feature> { * @see #getFeatures() * @see #setFeatures(FeatureSet) */ - @SuppressWarnings("this-escape") public final ObjectProperty<FeatureSet> featuresProperty = new SimpleObjectProperty<>(this, "features"); /** diff --git a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/dataset/ResourceExplorer.java b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/dataset/ResourceExplorer.java index ed1c996477..3b4f394bf3 100644 --- a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/dataset/ResourceExplorer.java +++ b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/dataset/ResourceExplorer.java @@ -181,7 +181,6 @@ public class ResourceExplorer extends Widget { /** * Creates a new panel for exploring resources. */ - @SuppressWarnings("this-escape") // `this` appears in a cyclic graph. public ResourceExplorer() { this(null); } diff --git a/optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/GDALStore.java b/optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/GDALStore.java index a132392c13..08830e78e6 100644 --- a/optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/GDALStore.java +++ b/optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/GDALStore.java @@ -177,7 +177,7 @@ public class GDALStore extends DataStore implements Aggregate { * @param driver name of the driver to use. * @throws DataStoreException if an error occurred while creating the data store for the given storage. */ - @SuppressWarnings("this-escape") + @SuppressWarnings("LeakingThisInConstructor") GDALStore(final GDALStore parent, final String url, final String driver) throws DataStoreException { super(parent, parent.getProvider(), new StorageConnector(url), false); path = parent.path;
