This is an automated email from the ASF dual-hosted git repository. desruisseaux pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/sis.git
commit 96e4ba9bdeed2e1388051e6c584c7961b609e7fb Merge: 8a62a3c524 9b695745b2 Author: Martin Desruisseaux <[email protected]> AuthorDate: Tue Apr 14 13:30:03 2026 +0200 Merge branch 'geoapi-3.1' .../org.apache.sis.metadata/main/module-info.java | 4 ++ .../sis/xml/bind/metadata/replace/SensorType.java | 6 +-- .../apache/sis/util/collection/CodeListSet.java | 53 ++++++++++++---------- .../apache/sis/util/internal/shared/CodeLists.java | 34 +++++++++----- .../sis/util/collection/CodeListSetTest.java | 11 +++-- .../apache/sis/util/collection/LargeCodeList.java | 12 +++-- .../gui/referencing/PositionableProjection.java | 2 +- 7 files changed, 75 insertions(+), 47 deletions(-) diff --cc endorsed/src/org.apache.sis.metadata/main/org/apache/sis/xml/bind/metadata/replace/SensorType.java index 7a50418449,bb6ca798b4..cdc986e40e --- a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/xml/bind/metadata/replace/SensorType.java +++ b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/xml/bind/metadata/replace/SensorType.java @@@ -20,10 -21,6 +21,9 @@@ import org.opengis.annotation.UML import org.opengis.annotation.Specification; import org.opengis.util.CodeList; +// Specific to the main branch: - import java.util.List; +import java.util.ArrayList; + /** * The code list for {@code <gmi:MI_SensorTypeCode>}. @@@ -83,15 -74,14 +83,13 @@@ public final class SensorType extends C } /** - * Returns the list of codes of the same kind as this code list element. - * Invoking this method is equivalent to invoking {@link #values()}, except that - * this method can be invoked on an instance of the parent {@code CodeList} class. + * Returns the list of {@code SensorType}s. - * This method must be declared even if not invoked explicitly because it may be invoked - * by reflection by {@link org.apache.sis.util.internal.shared.CodeLists#values(Class)}. * - * @return the list of codes declared in the current <abbr>JVM</abbr>. + * @return all code {@linkplain #values() values} for this code list. */ - public static SensorType[] values() { - return VALUES.toArray(SensorType[]::new); + @Override + public SensorType[] family() { + return values(); } /** diff --cc endorsed/src/org.apache.sis.util/main/org/apache/sis/util/internal/shared/CodeLists.java index 1ed5b9f4ae,3989d5d35b..acf6741ad3 --- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/internal/shared/CodeLists.java +++ b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/internal/shared/CodeLists.java @@@ -16,17 -16,17 +16,15 @@@ */ package org.apache.sis.util.internal.shared; -import java.lang.reflect.Array; import java.lang.reflect.InvocationTargetException; --import java.lang.reflect.InaccessibleObjectException; import java.lang.reflect.UndeclaredThrowableException; - import java.util.function.Predicate; import org.opengis.util.CodeList; import org.apache.sis.util.CharSequences; import org.apache.sis.util.Characters.Filter; --import org.apache.sis.util.resources.Errors; -// Specific to the geoapi-3.1 and geoapi-4.0 branches: -import org.opengis.util.ControlledVocabulary; +// Specific to the main branch: +import java.lang.reflect.Array; ++import java.util.function.Predicate; /** diff --cc endorsed/src/org.apache.sis.util/test/org/apache/sis/util/collection/CodeListSetTest.java index 5a20b6cfb3,0c77c3a29d..0f4581d2e4 --- a/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/collection/CodeListSetTest.java +++ b/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/collection/CodeListSetTest.java @@@ -211,9 -214,9 +214,9 @@@ public final class CodeListSetTest exte */ @Test public void testFill() { - final CodeListSet<AxisDirection> c = new CodeListSet<>(AxisDirection.class, true); + final var c = new CodeListSet<AxisDirection>(AxisDirection.class, true); assertTrue(c.size() >= 32, "Expect at least 32 elements as of GeoAPI 3.0."); - assertTrue(c.toString().startsWith("[AxisDirection.OTHER, AxisDirection.NORTH, ")); + assertTrue(c.toString().startsWith("[AxisDirection[OTHER], AxisDirection[NORTH], ")); /* * Testing the full array would be too long and may change in future GeoAPI version * anyway. Actually the main interest of this test is to ensure that the toString() diff --cc endorsed/src/org.apache.sis.util/test/org/apache/sis/util/collection/LargeCodeList.java index c3841a0373,b559ff698a..1b05dce77e --- a/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/collection/LargeCodeList.java +++ b/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/collection/LargeCodeList.java @@@ -16,36 -16,29 +16,38 @@@ */ package org.apache.sis.util.collection; -import java.util.Arrays; + import java.util.List; import org.opengis.util.CodeList; +// Test dependencies +import static org.junit.jupiter.api.Assertions.*; + +// Specific to the main branch: - import java.util.List; +import java.util.ArrayList; + /** - * A code list containing more than 64 elements. This implementation can be used by tests - * that requires a large number of code list elements. + * A code list containing more than 64 elements. + * This implementation can be used by tests that requires a large number of code list elements. + * The implementation class must be public because the {@link #values()} method will be invoked + * by reflection from another package. * * @author Martin Desruisseaux (Geomatys) */ @SuppressWarnings("serial") -public final class LargeCodeList extends CodeList<LargeCodeList> { +public final class LargeCodeList extends CodeList<LargeCodeList> { + /** + * List of all enumerations of this type. + */ + private static final List<LargeCodeList> VALUES = new ArrayList<>(100); + /** - * Creates 100 code list elements. + * All code list values created in the currently running <abbr>JVM</abbr>. */ - private static final List<LargeCodeList> VALUES; static { - final var codes = new LargeCodeList[80]; - Arrays.setAll(codes, (i) -> new LargeCodeList("LC#" + i)); - VALUES = initialValues(codes); + for (int i=0; i<100; i++) { + assertEquals(i, new LargeCodeList(i).ordinal()); + } } /** diff --cc optional/src/org.apache.sis.gui/main/org/apache/sis/gui/referencing/PositionableProjection.java index 1a212d52b0,71d9d40b0d..0dcbbba89c --- a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/referencing/PositionableProjection.java +++ b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/referencing/PositionableProjection.java @@@ -36,10 -37,6 +37,9 @@@ import org.apache.sis.util.resources.Er import org.apache.sis.util.logging.Logging; import static org.apache.sis.gui.internal.LogHandler.LOGGER; +// Specific to the main branch: - import java.util.List; +import java.util.ArrayList; + /** * Provider of map projections centered on a point of interest.
