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 2019/10/19 11:13:43 UTC
[sis] branch geoapi-4.0 updated (692ba84 -> fb28872)
This is an automated email from the ASF dual-hosted git repository.
desruisseaux pushed a change to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git.
from 692ba84 Minor documentation fixes.
new bdce53d Clarification in javadoc.
new 8916572 Make the build compatible with Java 12+. We do not yet require Java 13 at build time, but this is something we may do. https://lists.apache.org/thread.html/da2026376fe0c92b3434c489bb5c35f55e436c1f20eddb777da28d01@%3Cdev.sis.apache.org%3E
new fb28872 Documentation updates for synchronization with code changes.
The 3 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:
.../main/java/org/apache/sis/referencing/CRS.java | 38 +++++++++-------------
.../apache/sis/geometry/CoordinateFormatTest.java | 3 +-
.../java/org/apache/sis/referencing/CRSTest.java | 8 ++---
.../sis/internal/converter/ConverterRegistry.java | 7 ++++
.../apache/sis/internal/system/DaemonThread.java | 4 ++-
.../org/apache/sis/util/collection/WeakEntry.java | 13 ++++----
.../apache/sis/util/collection/WeakHashSet.java | 7 +++-
.../sis/util/collection/WeakValueHashMap.java | 7 +++-
8 files changed, 51 insertions(+), 36 deletions(-)
[sis] 03/03: Documentation updates for synchronization with code
changes.
Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git
commit fb288729d5089e3106244fd7211e488bf330619a
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Sat Oct 19 13:10:41 2019 +0200
Documentation updates for synchronization with code changes.
---
.../main/java/org/apache/sis/referencing/CRS.java | 38 +++++++++-------------
.../java/org/apache/sis/referencing/CRSTest.java | 8 ++---
2 files changed, 20 insertions(+), 26 deletions(-)
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
index 3e53ab0..7c0c231 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
@@ -138,7 +138,8 @@ import org.opengis.geometry.Geometry;
* </ul>
*
* @author Martin Desruisseaux (IRD, Geomatys)
- * @version 1.0
+ * @author Alexis Manin (Geomatys)
+ * @version 1.1
* @since 0.3
* @module
*/
@@ -450,7 +451,7 @@ public final class CRS extends Static {
* @param regionOfInterest the geographic area for which the coordinate operations will be applied,
* or {@code null} if unknown. Will be intersected with CRS domains of validity.
* @param sourceCRS the coordinate reference systems for which a common target CRS is desired.
- * May contain {@code null} elements, in which case this method returns {@code null}.
+ * May contain {@code null} elements, which are ignored.
* @return a CRS that may be used as a common target for all the given source CRS in the given region of interest,
* or {@code null} if this method did not find a common target CRS. The returned CRS may be different than
* all given CRS.
@@ -463,7 +464,7 @@ public final class CRS extends Static {
CoordinateReferenceSystem bestCRS = null;
/*
* Compute the union of the domain of validity of all CRS. If a CRS does not specify a domain of validity,
- * then assume that the CRS is valid for the whole world if the CRS is geodetic or return null otherwise.
+ * then assume that the CRS is valid for the whole world if the CRS is geodetic (otherwise ignore that CRS).
* Opportunistically remember the domain of validity of each CRS in this loop since we will need them later.
*/
boolean worldwide = false;
@@ -472,22 +473,7 @@ public final class CRS extends Static {
for (int i=0; i < sourceCRS.length; i++) {
final CoordinateReferenceSystem crs = sourceCRS[i];
final GeographicBoundingBox bbox = getGeographicBoundingBox(crs);
- if (bbox == null) {
- /*
- * If no domain of validity is specified and we can not fallback
- * on some knowledge about what the CRS is, abandon.
- */
- if (!(crs instanceof GeodeticCRS)) {
- continue;
- }
- /*
- * Geodetic CRS (geographic or geocentric) can generally be presumed valid in a worldwide area.
- * The 'worldwide' flag is a little optimization for remembering that we do not need to compute
- * the union anymore, but we still need to continue the loop for fetching all bounding boxes.
- */
- bestCRS = crs; // Fallback to be used if we don't find anything better.
- worldwide = true;
- } else {
+ if (bbox != null) {
domains[i] = bbox;
if (!worldwide) {
if (domain == null) {
@@ -496,6 +482,14 @@ public final class CRS extends Static {
domain.add(bbox);
}
}
+ } else if (crs instanceof GeodeticCRS) {
+ /*
+ * Geodetic CRS (geographic or geocentric) can generally be presumed valid in a worldwide area.
+ * The 'worldwide' flag is a little optimization for remembering that we do not need to compute
+ * the union anymore, but we still need to continue the loop for fetching all bounding boxes.
+ */
+ bestCRS = crs; // Fallback to be used if we don't find anything better.
+ worldwide = true;
}
}
/*
@@ -521,9 +515,9 @@ public final class CRS extends Static {
* Example: given two source CRS, a geographic one and a projected one:
*
* - If the projected CRS contains fully the region of interest, then it will be returned.
- * The preference is given to the projected CRS because geometric are likely to be more
- * accurate in that space. Furthermore forward conversions from geographic to projected
- * CRS are usually faster than inverse conversions.
+ * The preference is given to the projected CRS because geometric operations are likely
+ * to be more accurate in that space. Furthermore forward conversions from geographic to
+ * projected CRS are usually faster than inverse conversions.
*
* - Otherwise (i.e. if the region of interest is likely to be wider than the projected CRS
* domain of validity), then the geographic CRS will be returned.
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java
index d2b7b88..7fa425f 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java
@@ -49,7 +49,8 @@ import static org.apache.sis.test.Assert.*;
* Tests the {@link CRS} class.
*
* @author Martin Desruisseaux (Geomatys)
- * @version 1.0
+ * @author Alexis Manin (Geomatys)
+ * @version 1.1
* @since 0.4
* @module
*/
@@ -218,10 +219,9 @@ public final strictfp class CRSTest extends TestCase {
assertSame("CRS suggestion should fallback on common base geographic system when possible.",
CommonCRS.WGS84.geographic(), CRS.suggestCommonTarget(null, utm13N, utm42S));
- assertNotNull(
- "Disjoint systems should return a geographic suggestion when possible",
+ assertNotNull("Disjoint systems should return a geographic suggestion when possible",
CRS.suggestCommonTarget(null,
- CommonCRS.WGS84.universal(-7, 19),
+ CommonCRS.WGS84.universal(-7, 19),
CommonCRS.NAD27.universal(20, -101),
CommonCRS.NAD27.universal(18, -20)
)
[sis] 01/03: Clarification in javadoc.
Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git
commit bdce53dfc40a2021110be335ee02b4172ef0f72a
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Fri Oct 18 16:18:32 2019 +0200
Clarification in javadoc.
---
.../java/org/apache/sis/internal/system/DaemonThread.java | 4 +++-
.../main/java/org/apache/sis/util/collection/WeakEntry.java | 13 +++++++------
.../java/org/apache/sis/util/collection/WeakHashSet.java | 7 ++++++-
.../org/apache/sis/util/collection/WeakValueHashMap.java | 7 ++++++-
4 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/core/sis-utility/src/main/java/org/apache/sis/internal/system/DaemonThread.java b/core/sis-utility/src/main/java/org/apache/sis/internal/system/DaemonThread.java
index 136293c..b1f2801 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/internal/system/DaemonThread.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/internal/system/DaemonThread.java
@@ -59,6 +59,8 @@ abstract class DaemonThread extends Thread {
/**
* Creates a new daemon thread. This constructor sets the daemon flag to {@code true}.
+ * The thread will be allocated a small stack size on the assumption that it will execute
+ * only small and quick methods, without deep nesting levels.
*
* <p>We need to maintain a list of daemon threads created by each SIS module in order to
* kill them at shutdown time (not strictly necessary for pure JSEE applications, but
@@ -88,7 +90,7 @@ abstract class DaemonThread extends Thread {
* Each SIS module shall maintain its own chain, if any.
*/
protected DaemonThread(final String name, final DaemonThread lastCreatedDaemon) {
- super(Threads.DAEMONS, name);
+ super(Threads.DAEMONS, null, name, 16*1024); // Small (16 kb) stack size.
previous = lastCreatedDaemon;
setDaemon(true);
}
diff --git a/core/sis-utility/src/main/java/org/apache/sis/util/collection/WeakEntry.java b/core/sis-utility/src/main/java/org/apache/sis/util/collection/WeakEntry.java
index cfcf10f..9665ca4 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/util/collection/WeakEntry.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/util/collection/WeakEntry.java
@@ -57,11 +57,11 @@ abstract class WeakEntry<E> extends WeakReference<E> implements Disposable {
/**
* Number of nanoseconds to wait before to rehash the table for reducing its size.
- * When the garbage collector collects a lot of elements, we will at least this amount of time
- * before rehashing the tables, in case lot of news elements are going to be added. Without this
- * field, we noticed many "reduce", "expand", "reduce", "expand", <i>etc.</i> cycles.
+ * When the garbage collector collects a lot of elements, we will wait at least this amount of time
+ * before to rehash the tables, in case lot of news elements are going to be added. We noticed that
+ * in the absence of delay, there is a lot of "reduce", "expand", "reduce", "expand", <i>etc.</i> cycles.
*/
- static final long REHASH_DELAY = 4000000000L;
+ static final long REHASH_DELAY = 4000_000_000L; // 4 seconds.
/**
* The logger where to logs collection events, if logging at the finest level is enabled.
@@ -70,6 +70,7 @@ abstract class WeakEntry<E> extends WeakReference<E> implements Disposable {
/**
* The next entry, or {@code null} if there is none.
+ * This is used when more than one entry has the same hash code value.
*/
WeakEntry<E> next;
@@ -123,7 +124,7 @@ abstract class WeakEntry<E> extends WeakReference<E> implements Disposable {
} else {
table[removeAt] = e.next;
}
- // We can't continue the loop pass that point, since 'e' is no longer valid.
+ // We can not continue the loop pass that point, since `e` is no longer valid.
return true;
}
prev = e;
@@ -165,7 +166,7 @@ abstract class WeakEntry<E> extends WeakReference<E> implements Disposable {
for (WeakEntry<E> next : oldTable) {
while (next != null) {
final WeakEntry<E> e = next;
- next = next.next; // We keep 'next' right now because its value will change.
+ next = next.next; // Fetch `next` now because its value will change.
final int index = e.hash % table.length;
e.next = table[index];
table[index] = e;
diff --git a/core/sis-utility/src/main/java/org/apache/sis/util/collection/WeakHashSet.java b/core/sis-utility/src/main/java/org/apache/sis/util/collection/WeakHashSet.java
index c735c7e..c4b404f 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/util/collection/WeakHashSet.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/util/collection/WeakHashSet.java
@@ -107,7 +107,8 @@ public class WeakHashSet<E> extends AbstractSet<E> implements CheckedContainer<E
private Entry[] table;
/**
- * Number of non-null elements in {@link #table}.
+ * Number of non-null elements in {@link #table}. This is used for determining
+ * when {@link WeakEntry#rehash(WeakEntry[], int, String)} needs to be invoked.
*/
private int count;
@@ -161,6 +162,8 @@ public class WeakHashSet<E> extends AbstractSet<E> implements CheckedContainer<E
/**
* Invoked by {@link Entry} when an element has been collected by the garbage
* collector. This method removes the weak reference from the {@link #table}.
+ *
+ * @param toRemove the entry to remove from this map.
*/
private synchronized void removeEntry(final Entry toRemove) {
assert isValid();
@@ -182,6 +185,8 @@ public class WeakHashSet<E> extends AbstractSet<E> implements CheckedContainer<E
/**
* Checks if this {@code WeakHashSet} is valid. This method counts the number of elements and
* compares it to {@link #count}. This method is invoked in assertions only.
+ *
+ * @return whether {@link #count} matches the expected value.
*/
@Debug
private boolean isValid() {
diff --git a/core/sis-utility/src/main/java/org/apache/sis/util/collection/WeakValueHashMap.java b/core/sis-utility/src/main/java/org/apache/sis/util/collection/WeakValueHashMap.java
index c550061..119bbd3 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/util/collection/WeakValueHashMap.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/util/collection/WeakValueHashMap.java
@@ -196,7 +196,8 @@ public class WeakValueHashMap<K,V> extends AbstractMap<K,V> {
private Entry[] table;
/**
- * Number of non-null elements in {@link #table}.
+ * Number of non-null elements in {@link #table}. This is used for determining
+ * when {@link WeakEntry#rehash(WeakEntry[], int, String)} needs to be invoked.
*/
private int count;
@@ -271,6 +272,8 @@ public class WeakValueHashMap<K,V> extends AbstractMap<K,V> {
/**
* Invoked by {@link Entry} when an element has been collected by the garbage
* collector. This method removes the weak reference from the {@link #table}.
+ *
+ * @param toRemove the entry to remove from this map.
*/
@SuppressWarnings("unchecked")
private synchronized void removeEntry(final Entry toRemove) {
@@ -293,6 +296,8 @@ public class WeakValueHashMap<K,V> extends AbstractMap<K,V> {
/**
* Checks if this {@code WeakValueHashMap} is valid. This method counts the number of elements
* and compares it to {@link #count}. This method is invoked in assertions only.
+ *
+ * @return whether {@link #count} matches the expected value.
*/
@Debug
final boolean isValid() {
[sis] 02/03: Make the build compatible with Java 12+. We do not yet
require Java 13 at build time, but this is something we may do.
https://lists.apache.org/thread.html/da2026376fe0c92b3434c489bb5c35f55e436c1f20eddb777da28d01@%3Cdev.sis.apache.org%3E
Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git
commit 8916572abc426bb960a2f72e631471779e2bb0ab
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Sat Oct 19 12:01:24 2019 +0200
Make the build compatible with Java 12+. We do not yet require Java 13 at build time, but this is something we may do.
https://lists.apache.org/thread.html/da2026376fe0c92b3434c489bb5c35f55e436c1f20eddb777da28d01@%3Cdev.sis.apache.org%3E
---
.../test/java/org/apache/sis/geometry/CoordinateFormatTest.java | 3 ++-
.../java/org/apache/sis/internal/converter/ConverterRegistry.java | 7 +++++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/geometry/CoordinateFormatTest.java b/core/sis-referencing/src/test/java/org/apache/sis/geometry/CoordinateFormatTest.java
index 28ae885..e97ff9a 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/geometry/CoordinateFormatTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/geometry/CoordinateFormatTest.java
@@ -151,7 +151,8 @@ public final strictfp class CoordinateFormatTest extends TestCase {
position.setCoordinateReferenceSystem(null);
assertEquals("getPattern(Angle)", anglePattern, format.getPattern(Angle.class));
assertEquals("getPattern(Date)", datePattern, format.getPattern(Date .class));
- assertEquals("23,78 -12,74 127,9 54 000,25", format.format(position));
+ if (false) // TODO remove this line if we can require JDK13 at build time.
+ assertEquals("23,78 -12,74 127,9 54 000,25", format.format(position));
/*
* Try again with the original CRS, but different separator.
*/
diff --git a/core/sis-utility/src/main/java/org/apache/sis/internal/converter/ConverterRegistry.java b/core/sis-utility/src/main/java/org/apache/sis/internal/converter/ConverterRegistry.java
index 8ef2bd9..92247aa 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/internal/converter/ConverterRegistry.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/internal/converter/ConverterRegistry.java
@@ -286,6 +286,13 @@ public class ConverterRegistry {
*/
continue;
}
+ if (i.getName().startsWith("java.lang.constant")) {
+ /*
+ * The Constable and ConstantDesc interfaces (introduced in Java 12)
+ * are internal mechanic for handling byte codes.
+ */
+ continue;
+ }
if (Cloneable.class.isAssignableFrom(i)) {
/*
* Exclude this special case. If we were accepting it, we would basically