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 2013/12/26 07:04:00 UTC
svn commit: r1553457 [3/4] - in /sis/trunk: ./
core/sis-metadata/src/main/java/org/apache/sis/metadata/
core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/
core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/
core/sis-metadata/src/test...
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/io/TableAppender.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/io/TableAppender.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/io/TableAppender.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/io/TableAppender.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -22,7 +22,6 @@ import java.util.List;
import java.io.Flushable;
import java.io.IOException;
import org.apache.sis.util.ArraysExt;
-import org.apache.sis.util.Decorator;
import org.apache.sis.util.CharSequences;
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.resources.Errors;
@@ -79,7 +78,6 @@ import org.apache.sis.internal.jdk7.JDK7
*
* @see org.apache.sis.util.collection.TreeTableFormat
*/
-@Decorator(Appendable.class)
public class TableAppender extends Appender implements Flushable {
/**
* A possible value for cell alignment. This specifies that the text is aligned
@@ -285,9 +283,9 @@ public class TableAppender extends Appen
*/
int boxCount = 0;
final char[][] box = new char[BOX.length][];
- for (int i=0; i<BOX.length; i++) {
- if (BOX[i][9] == horizontalChar) {
- box[boxCount++] = BOX[i];
+ for (final char[] row : BOX) {
+ if (row[9] == horizontalChar) {
+ box[boxCount++] = row;
}
}
/*
@@ -421,6 +419,7 @@ public class TableAppender extends Appen
* </ul>
*
* @param c Character to write.
+ * @return {@code this}.
*/
@Override
public TableAppender append(final char c) {
@@ -470,6 +469,7 @@ public class TableAppender extends Appen
* @param sequence The character sequence to be written.
* @param start Index from which to start reading characters.
* @param end Index of the character following the last character to read.
+ * @return {@code this}.
*/
@Override
@SuppressWarnings("fallthrough")
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Angle.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Angle.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Angle.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Angle.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -23,7 +23,6 @@ import java.util.FormattableFlags;
import java.text.Format;
import java.text.ParseException;
import java.io.Serializable;
-import org.apache.sis.util.Immutable;
import org.apache.sis.internal.util.Utilities;
import static java.lang.Double.doubleToLongBits;
@@ -41,6 +40,11 @@ import static org.apache.sis.math.MathFu
* {@code "%s"} conversion specifier of {@link Formatter}, but this is less efficient for this
* class.
*
+ * {@section Immutability and thread safety}
+ * This class and the {@link Latitude} / {@link Longitude} subclasses are immutable, and thus
+ * inherently thread-safe. Other subclasses may or may not be immutable, at implementation choice
+ * (see {@link java.lang.Number} for an example of a similar in purpose class having mutable subclasses).
+ *
* @author Martin Desruisseaux (MPO, IRD, Geomatys)
* @since 0.3 (derived from geotk-1.0)
* @version 0.3
@@ -50,7 +54,6 @@ import static org.apache.sis.math.MathFu
* @see Longitude
* @see AngleFormat
*/
-@Immutable
public class Angle implements Comparable<Angle>, Formattable, Serializable {
/**
* Serial number for inter-operability with different versions.
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Latitude.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Latitude.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Latitude.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Latitude.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -16,13 +16,14 @@
*/
package org.apache.sis.measure;
-import org.apache.sis.util.Immutable;
-
/**
* A latitude angle in decimal degrees.
* Positive latitudes are North, while negative latitudes are South.
*
+ * {@section Immutability and thread safety}
+ * This final class is immutable and thus inherently thread-safe.
+ *
* @author Martin Desruisseaux (MPO, IRD, Geomatys)
* @since 0.3 (derived from geotk-1.0)
* @version 0.4
@@ -31,7 +32,6 @@ import org.apache.sis.util.Immutable;
* @see Longitude
* @see AngleFormat
*/
-@Immutable
public final class Latitude extends Angle {
/**
* Serial number for inter-operability with different versions.
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Longitude.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Longitude.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Longitude.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Longitude.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -16,13 +16,14 @@
*/
package org.apache.sis.measure;
-import org.apache.sis.util.Immutable;
-
/**
* A longitude angle in decimal degrees.
* Positive longitudes are East, while negative longitudes are West.
*
+ * {@section Immutability and thread safety}
+ * This final class is immutable and thus inherently thread-safe.
+ *
* @author Martin Desruisseaux (MPO, IRD, Geomatys)
* @since 0.3 (derived from geotk-1.0)
* @version 0.4
@@ -31,7 +32,6 @@ import org.apache.sis.util.Immutable;
* @see Latitude
* @see AngleFormat
*/
-@Immutable
public final class Longitude extends Angle {
/**
* Serial number for inter-operability with different versions.
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/MeasurementRange.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/MeasurementRange.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/MeasurementRange.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/MeasurementRange.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -20,7 +20,6 @@ import javax.measure.unit.Unit;
import javax.measure.converter.UnitConverter;
import javax.measure.converter.ConversionException;
import org.apache.sis.util.Numbers;
-import org.apache.sis.util.Immutable;
import org.apache.sis.util.resources.Errors;
// Related to JDK7
@@ -43,6 +42,11 @@ import org.apache.sis.internal.jdk7.Obje
* <li>{@link #castTo(Class)} for casting the range values to an other type.</li>
* </ul>
*
+ * {@section Immutability and thread safety}
+ * This class is immutable and thus inherently thread-safe.
+ * Subclasses may or may not be immutable, at implementation choice. But implementors are
+ * encouraged to make sure that subclasses remain immutable for more predictable behavior.
+ *
* @param <E> The type of range elements as a subclass of {@link Number}.
*
* @author Martin Desruisseaux (IRD)
@@ -53,7 +57,6 @@ import org.apache.sis.internal.jdk7.Obje
* @see RangeFormat
* @see org.apache.sis.util.collection.RangeSet
*/
-@Immutable
public class MeasurementRange<E extends Number & Comparable<? super E>> extends NumberRange<E> {
/**
* Serial number for inter-operability with different versions.
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/NumberRange.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/NumberRange.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/NumberRange.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/NumberRange.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -17,7 +17,6 @@
package org.apache.sis.measure;
import org.apache.sis.util.Numbers;
-import org.apache.sis.util.Immutable;
import org.apache.sis.util.resources.Errors;
@@ -61,6 +60,11 @@ import org.apache.sis.util.resources.Err
* {@linkplain org.opengis.coverage.DiscreteCoverage discrete coverages}, the {@code NumberRange} class can
* also be used with {@linkplain org.opengis.coverage.ContinuousCoverage continuous coverages}.
*
+ * {@section Immutability and thread safety}
+ * This class and the {@link MeasurementRange} subclasses are immutable, and thus inherently thread-safe.
+ * Other subclasses may or may not be immutable, at implementation choice. But implementors are encouraged
+ * to make sure that all subclasses remain immutable for more predictable behavior.
+ *
* @param <E> The type of range elements as a subclass of {@link Number}.
*
* @author Martin Desruisseaux (IRD)
@@ -73,7 +77,6 @@ import org.apache.sis.util.resources.Err
* @see org.apache.sis.util.collection.RangeSet
* @see <a href="http://en.wikipedia.org/wiki/Interval_%28mathematics%29">Wikipedia: Interval</a>
*/
-@Immutable
public class NumberRange<E extends Number & Comparable<? super E>> extends Range<E> {
/**
* Serial number for inter-operability with different versions.
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Range.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Range.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Range.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Range.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -25,7 +25,6 @@ import org.apache.sis.internal.util.Util
import org.apache.sis.util.collection.CheckedContainer;
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.Emptiable;
-import org.apache.sis.util.Immutable;
import org.apache.sis.util.Numbers;
// Related to JDK7
@@ -75,6 +74,11 @@ import org.apache.sis.internal.jdk7.Obje
* numeric ranges can be associated to {@linkplain org.opengis.coverage.ContinuousCoverage
* continuous coverages}.</p>
*
+ * {@section Immutability and thread safety}
+ * This class and the {@link NumberRange} / {@link MeasurementRange} subclasses are immutable,
+ * and thus inherently thread-safe. Other subclasses may or may not be immutable, at implementation choice.
+ * But implementors are encouraged to make sure that all subclasses remain immutable for more predictable behavior.
+ *
* @param <E> The type of range elements, typically a {@link Number} subclass or {@link java.util.Date}.
*
* @author Joe White
@@ -87,7 +91,6 @@ import org.apache.sis.internal.jdk7.Obje
* @see RangeFormat
* @see org.apache.sis.util.collection.RangeSet
*/
-@Immutable
public class Range<E extends Comparable<? super E>> implements CheckedContainer<E>, Formattable, Emptiable, Serializable {
/**
* For cross-version compatibility.
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/SexagesimalConverter.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/SexagesimalConverter.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/SexagesimalConverter.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/SexagesimalConverter.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -22,7 +22,6 @@ import javax.measure.unit.Unit;
import javax.measure.unit.NonSI;
import javax.measure.quantity.Angle;
import javax.measure.converter.UnitConverter;
-import org.apache.sis.util.Immutable;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.resources.Vocabulary;
@@ -39,12 +38,14 @@ import static org.apache.sis.math.MathFu
* by {@link AngleFormat}) rather than a unit issue. Unfortunately, this pseudo-unit is extensively
* used in the EPSG database, so we have to support it.</p>
*
+ * {@section Immutability and thread safety}
+ * This class and all inner classes are immutable, and thus inherently thread-safe.
+ *
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.3 (derived from geotk-2.1)
* @version 0.3
* @module
*/
-@Immutable
class SexagesimalConverter extends UnitConverter { // Intentionally not final.
/**
* Serial number for compatibility with different versions.
@@ -210,7 +211,6 @@ class SexagesimalConverter extends UnitC
/**
* The inverse of {@link SexagesimalConverter}.
*/
- @Immutable
private static final class Inverse extends SexagesimalConverter {
/**
* Serial number for compatibility with different versions.
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -31,7 +31,8 @@ import org.apache.sis.util.ArraysExt;
import org.apache.sis.util.Exceptions;
import org.apache.sis.util.CharSequences;
import org.apache.sis.util.resources.Errors;
-import org.apache.sis.internal.util.URIParser;
+import org.apache.sis.internal.util.DefinitionURI;
+import org.apache.sis.internal.util.XPaths;
import static java.lang.Math.PI;
import static java.lang.Math.abs;
@@ -338,20 +339,20 @@ public final class Units extends Static
* If the unit is not an authority code (which is the most common case), then we
* will check for hard-coded unit symbols.
*
- * URIParser.codeOf(…) returns 'uom' directly (provided that whitespaces were already trimmed)
+ * DefinitionURI.codeOf(…) returns 'uom' directly (provided that whitespaces were already trimmed)
* if no ':' character were found, in which case the string is assumed to be the code directly.
* This is the intended behavior for AuthorityFactory, but in the particular case of this method
* we want to try to parse as a xpointer before to give up.
*/
if (isURI(uom)) {
- String code = URIParser.codeOf("uom", "EPSG", uom);
+ String code = DefinitionURI.codeOf("uom", "EPSG", uom);
if (code != null && code != uom) try { // Really identity check, see above comment.
return valueOfEPSG(Integer.parseInt(code));
} catch (NumberFormatException e) {
throw new IllegalArgumentException(Errors.format(
Errors.Keys.IllegalArgumentValue_2, "uom", uom), e);
}
- code = URIParser.xpointer("uom", uom);
+ code = XPaths.xpointer("uom", uom);
if (code != null) {
uom = code;
}
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -1968,7 +1968,8 @@ cmp: while (ia < lga) {
/**
* Replaces all occurrences of a given string in the given character sequence. If no occurrence of
- * {@code toSearch} is found in the given text, then this method returns the {@code text} unchanged.
+ * {@code toSearch} is found in the given text or if {@code toSearch} is equal to {@code replaceBy},
+ * then this method returns the {@code text} unchanged.
* Otherwise this method returns a new character sequence with all occurrences replaced by {@code replaceBy}.
*
* <p>This method is similar to {@link String#replace(CharSequence, CharSequence)} except for the following:</p>
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Version.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Version.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Version.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Version.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -32,12 +32,16 @@ import org.apache.sis.util.resources.Err
* <p>This class provides methods for performing comparisons of {@code Version} objects where major,
* minor and revision parts are compared as numbers when possible, or as strings otherwise.</p>
*
+ * {@section Immutability and thread safety}
+ * This class is immutable and thus inherently thread-safe.
+ * Subclasses may or may not be immutable, at implementation choice. But implementors are
+ * encouraged to make sure that subclasses remain immutable for more predictable behavior.
+ *
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.3 (derived from geotk-2.4)
* @version 0.4
* @module
*/
-@Immutable
public class Version implements CharSequence, Comparable<Version>, Serializable {
/**
* For cross-version compatibility.
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/Cache.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/Cache.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/Cache.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/Cache.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -28,7 +28,6 @@ import java.util.concurrent.locks.Reentr
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.lang.ref.SoftReference;
-import org.apache.sis.util.ThreadSafe;
import org.apache.sis.util.Disposable;
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.resources.Errors;
@@ -141,7 +140,6 @@ import org.apache.sis.internal.jdk8.Supp
* @version 0.4
* @module
*/
-@ThreadSafe
public class Cache<K,V> extends AbstractMap<K,V> {
/**
* The map that contains the cached values. If a value is under the process of being
@@ -864,6 +862,8 @@ public class Cache<K,V> extends Abstract
* than the ones documented in the {@link ConcurrentHashMap#entrySet()} method, except that
* it doesn't support removal of elements (including through the {@link Iterator#remove}
* method call).
+ *
+ * @return A view of the entries contained in this map.
*/
@Override
public Set<Entry<K,V>> entrySet() {
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/CacheEntries.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/CacheEntries.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/CacheEntries.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/CacheEntries.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -23,7 +23,6 @@ import java.util.AbstractSet;
import java.util.AbstractMap.SimpleEntry;
import java.util.NoSuchElementException;
import java.lang.ref.Reference;
-import org.apache.sis.util.ThreadSafe;
/**
@@ -33,6 +32,9 @@ import org.apache.sis.util.ThreadSafe;
* <p>This class is not needed for the normal working of {@link Cache}. it is used only if
* the user wants to see the cache entries through the standard Java collection API.</p>
*
+ * {@section Thread safety}
+ * This class is thread-safe if and only if the {@code Set} given to the constructor is thread-safe.
+ *
* @param <K> The type of key objects.
* @param <V> The type of value objects.
*
@@ -41,7 +43,6 @@ import org.apache.sis.util.ThreadSafe;
* @version 0.3
* @module
*/
-@ThreadSafe // Assuming that the set given to the constructor is concurrent.
final class CacheEntries<K,V> extends AbstractSet<Map.Entry<K,V>> {
/**
* The set of entries in the {@link Cache#map}.
@@ -50,6 +51,8 @@ final class CacheEntries<K,V> extends Ab
/**
* Wraps the given set of entries of a {@link Cache#map}.
+ *
+ * @param entries The set of entries. Implementation shall support concurrency.
*/
CacheEntries(final Set<Map.Entry<K,Object>> entries) {
this.entries = entries;
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/CodeListSet.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/CodeListSet.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/CodeListSet.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/CodeListSet.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -26,6 +26,8 @@ import java.lang.reflect.Modifier;
import org.opengis.util.CodeList;
import org.apache.sis.util.iso.Types;
import org.apache.sis.util.resources.Errors;
+import org.apache.sis.util.NullArgumentException;
+import org.apache.sis.internal.util.CheckedArrayList;
/**
@@ -52,7 +54,7 @@ import org.apache.sis.util.resources.Err
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.3
- * @version 0.3
+ * @version 0.4
* @module
*
* @see java.util.EnumSet
@@ -76,7 +78,7 @@ public class CodeListSet<E extends CodeL
*
* @see #getElementType()
*/
- private final Class<E> elementType;
+ private final Class<E> elementType;
/**
* A bitmask of code list values present in this map.
@@ -215,6 +217,22 @@ public class CodeListSet<E extends CodeL
*/
@Override
public boolean add(final E element) {
+ if (element == null) {
+ final String message = CheckedArrayList.illegalElement(this, element, elementType);
+ if (message == null) {
+ /*
+ * If a unmarshalling process is under way, silently discard null element.
+ * This case happen when a codeListValue attribute in a XML file is empty.
+ * See https://issues.apache.org/jira/browse/SIS-157
+ */
+ return false;
+ }
+ if (element == null) {
+ throw new NullArgumentException(message);
+ } else {
+ throw new IllegalArgumentException(message);
+ }
+ }
int ordinal = element.ordinal();
if (ordinal < Long.SIZE) {
return values != (values |= (1L << ordinal));
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/DerivedIterator.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/DerivedIterator.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/DerivedIterator.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/DerivedIterator.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -17,7 +17,6 @@
package org.apache.sis.util.collection;
import java.util.Iterator;
-import org.apache.sis.util.Decorator;
import org.apache.sis.util.ObjectConverter;
@@ -34,7 +33,6 @@ import org.apache.sis.util.ObjectConvert
* @version 0.3
* @module
*/
-@Decorator(Iterator.class)
final class DerivedIterator<S,E> implements Iterator<E> {
/**
* The original iterator to wrap.
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/DerivedMap.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/DerivedMap.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/DerivedMap.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/DerivedMap.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -21,7 +21,6 @@ import java.util.Set;
import java.util.EnumSet;
import java.util.AbstractMap;
import java.io.Serializable;
-import org.apache.sis.util.Decorator;
import org.apache.sis.util.ObjectConverter;
import org.apache.sis.util.UnconvertibleObjectException;
import org.apache.sis.util.resources.Errors;
@@ -66,7 +65,6 @@ import org.apache.sis.math.FunctionPrope
* @version 0.3
* @module
*/
-@Decorator(Map.class)
class DerivedMap<SK,SV,K,V> extends AbstractMap<K,V> implements
ObjectConverter<Map.Entry<SK,SV>, Map.Entry<K,V>>, Serializable
{
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/DerivedSet.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/DerivedSet.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/DerivedSet.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/DerivedSet.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -20,7 +20,6 @@ import java.util.Set;
import java.util.Iterator;
import java.util.AbstractSet;
import java.io.Serializable;
-import org.apache.sis.util.Decorator;
import org.apache.sis.util.ObjectConverter;
import org.apache.sis.math.FunctionProperty;
import org.apache.sis.util.UnconvertibleObjectException;
@@ -62,7 +61,6 @@ import org.apache.sis.util.resources.Err
* @version 0.3
* @module
*/
-@Decorator(Set.class)
class DerivedSet<S,E> extends AbstractSet<E> implements CheckedContainer<E>, Serializable {
/**
* Serial number for inter-operability with different versions.
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/WeakHashSet.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/WeakHashSet.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/WeakHashSet.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/WeakHashSet.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -23,7 +23,6 @@ import java.lang.reflect.Array;
import org.apache.sis.util.Debug;
import org.apache.sis.util.ArraysExt;
import org.apache.sis.util.Utilities;
-import org.apache.sis.util.ThreadSafe;
import org.apache.sis.util.Workaround;
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.NullArgumentException;
@@ -63,8 +62,12 @@ import org.apache.sis.internal.jdk7.Obje
* }
* }
*
- * Thus, {@code WeakHashSet} can be used inside a factory to prevent creating duplicate
- * immutable objects.
+ * Thus, {@code WeakHashSet} can be used inside a factory to prevent creating duplicate immutable objects.
+ *
+ * {@section Thread safety}
+ * The same {@code WeakHashSet} instance can be safely used by many threads without synchronization on the part of
+ * the caller. But if a sequence of two or more method calls need to appear atomic from other threads perspective,
+ * then the caller can synchronize on {@code this}.
*
* @param <E> The type of elements in the set.
*
@@ -75,7 +78,6 @@ import org.apache.sis.internal.jdk7.Obje
*
* @see java.util.WeakHashMap
*/
-@ThreadSafe
public class WeakHashSet<E> extends AbstractSet<E> implements CheckedContainer<E> {
/**
* A weak reference to an element. This is an element in a linked list.
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/WeakValueHashMap.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/WeakValueHashMap.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/WeakValueHashMap.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/WeakValueHashMap.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -27,7 +27,6 @@ import java.lang.ref.WeakReference;
import org.apache.sis.util.Debug;
import org.apache.sis.util.ArraysExt;
import org.apache.sis.util.Utilities;
-import org.apache.sis.util.ThreadSafe;
import org.apache.sis.util.Workaround;
import org.apache.sis.util.NullArgumentException;
import org.apache.sis.util.resources.Errors;
@@ -71,6 +70,11 @@ import org.apache.sis.internal.jdk7.Obje
* <p>{@code WeakValueHashMap} works with array keys as one would expect. For example arrays of {@code int[]} are
* compared using the {@link java.util.Arrays#equals(int[], int[])} method.</p>
*
+ * {@section Thread safety}
+ * The same {@code WeakValueHashMap} instance can be safely used by many threads without synchronization on the part
+ * of the caller. But if a sequence of two or more method calls need to appear atomic from other threads perspective,
+ * then the caller can synchronize on {@code this}.
+ *
* @param <K> The class of key elements.
* @param <V> The class of value elements.
*
@@ -83,7 +87,6 @@ import org.apache.sis.internal.jdk7.Obje
* @see WeakHashSet
* @see Cache
*/
-@ThreadSafe
public class WeakValueHashMap<K,V> extends AbstractMap<K,V> {
/**
* Comparison mode for key objects. The standard mode is {@code EQUALS}, which means that keys are compared
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -29,7 +29,6 @@ import org.opengis.util.GenericName;
import org.opengis.util.InternationalString;
import org.apache.sis.internal.system.DefaultFactories;
import org.apache.sis.util.resources.Errors;
-import org.apache.sis.util.Immutable;
// Related to JDK7
import org.apache.sis.internal.jdk7.Objects;
@@ -52,6 +51,10 @@ import org.apache.sis.internal.jdk7.Obje
* This class has a natural ordering that is inconsistent with {@link #equals(Object)}.
* See {@link #compareTo(GenericName)} for more information.
*
+ * {@section Immutability and thread safety}
+ * This base class is immutable and thread-safe. Subclasses shall make sure that any overridden methods
+ * remain safe to call from multiple threads and do not change any public {@code GenericName} state.
+ *
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.3 (derived from geotk-2.1)
* @version 0.3
@@ -321,13 +324,13 @@ public abstract class AbstractName imple
/**
* An international string built from a snapshot of {@link GenericName}.
+ * This class is immutable is the list given to the constructor is immutable.
*
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.3 (derived from geotk-2.1)
* @version 0.3
* @module
*/
- @Immutable
private static final class International extends SimpleInternationalString {
/**
* Serial number for inter-operability with different versions.
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultInternationalString.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultInternationalString.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultInternationalString.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultInternationalString.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -30,7 +30,6 @@ import java.util.logging.Level;
import java.util.logging.LogRecord;
import org.opengis.util.InternationalString;
import org.apache.sis.util.Locales;
-import org.apache.sis.util.ThreadSafe;
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.resources.Errors;
@@ -49,6 +48,10 @@ import org.apache.sis.internal.jdk7.Obje
* This behavior is a compromise between making constructions easier, and being suitable for
* use in immutable objects.
*
+ * {@section Thread safety}
+ * Instances of {@code DefaultInternationalString} are thread-safe. While those instances are not strictly immutable,
+ * SIS typically references them as if they were immutable because of their <cite>add-only</cite> behavior.
+ *
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.3 (derived from geotk-2.1)
* @version 0.3
@@ -56,7 +59,6 @@ import org.apache.sis.internal.jdk7.Obje
*
* @see Types#toInternationalString(Map, String)
*/
-@ThreadSafe
public class DefaultInternationalString extends AbstractInternationalString implements Serializable {
/**
* Serial number for inter-operability with different versions.
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -31,7 +31,6 @@ import org.opengis.util.MemberName;
import org.opengis.util.GenericName;
import org.opengis.util.InternationalString;
import org.apache.sis.xml.Namespaces;
-import org.apache.sis.util.Immutable;
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.internal.system.DefaultFactories;
import org.apache.sis.internal.jaxb.gco.CharSequenceAdapter;
@@ -53,12 +52,16 @@ import org.apache.sis.internal.jdk7.Obje
* <li>{@link DefaultNameFactory#parseGenericName(NameSpace, CharSequence)} without separator</li>
* </ul>
*
+ * {@section Immutability and thread safety}
+ * This class is immutable and thus inherently thread-safe if the {@link NameSpace} and {@link CharSequence}
+ * arguments given to the constructor are also immutable. Subclasses shall make sure that any overridden methods
+ * remain safe to call from multiple threads and do not change any public {@code LocalName} state.
+ *
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.3 (derived from geotk-2.1)
* @version 0.3
* @module
*/
-@Immutable
@XmlType(name = "LocalName") // Actually 'gml:CodeType', but the later is used elsewhere.
@XmlRootElement(name = "LocalName")
public class DefaultLocalName extends AbstractName implements LocalName {
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultMemberName.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultMemberName.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultMemberName.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultMemberName.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -21,7 +21,6 @@ import javax.xml.bind.annotation.XmlRoot
import org.opengis.util.MemberName;
import org.opengis.util.NameSpace;
import org.opengis.util.TypeName;
-import org.apache.sis.util.Immutable;
import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
@@ -34,12 +33,17 @@ import static org.apache.sis.util.Argume
* <li>{@link DefaultNameFactory#createMemberName(NameSpace, CharSequence, TypeName)}</li>
* </ul>
*
+ * {@section Immutability and thread safety}
+ * This class is immutable and thus inherently thread-safe if the {@link NameSpace}, {@link CharSequence} and
+ * {@link TypeName} arguments given to the constructor are also immutable. Subclasses shall make sure that any
+ * overridden methods remain safe to call from multiple threads and do not change any public {@code MemberName}
+ * state.
+ *
* @author Guilhem Legal (Geomatys)
* @since 0.3 (derived from geotk-3.17)
* @version 0.3
* @module
*/
-@Immutable
@XmlRootElement(name = "MemberName")
public class DefaultMemberName extends DefaultLocalName implements MemberName {
/**
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameFactory.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameFactory.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameFactory.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameFactory.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -28,7 +28,6 @@ import org.opengis.util.MemberName;
import org.opengis.util.GenericName;
import org.opengis.util.NameFactory;
import org.opengis.util.InternationalString;
-import org.apache.sis.util.ThreadSafe;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.NullArgumentException;
import org.apache.sis.util.collection.WeakHashSet;
@@ -61,12 +60,16 @@ import static org.apache.sis.util.iso.De
* <li>{@link #parseGenericName(NameSpace, CharSequence)}</li>
* </ul>
*
+ * {@section Thread safety}
+ * The same {@code DefaultNameFactory} instance can be safely used by many threads without synchronization
+ * on the part of the caller. Subclasses should make sure that any overridden methods remain safe to call
+ * from multiple threads.
+ *
* @author Martin Desruisseaux (Geomatys)
* @since 0.3 (derived from geotk-2.1)
* @version 0.3
* @module
*/
-@ThreadSafe
public class DefaultNameFactory extends AbstractFactory implements NameFactory {
/**
* Weak references to the name created by this factory.
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -28,7 +28,6 @@ import org.opengis.util.ScopedName;
import org.opengis.util.GenericName;
import org.opengis.util.InternationalString;
import org.apache.sis.util.Debug;
-import org.apache.sis.util.Immutable;
import org.apache.sis.util.collection.WeakValueHashMap;
import org.apache.sis.internal.util.UnmodifiableArrayList;
@@ -48,12 +47,16 @@ import org.apache.sis.internal.jdk7.Obje
* <li>{@link DefaultNameFactory#createNameSpace(GenericName, Map)}</li>
* </ul>
*
+ * {@section Immutability and thread safety}
+ * This class is immutable and thus inherently thread-safe if the {@link NameSpace} and {@link CharSequence}
+ * arguments given to the constructor are also immutable. Subclasses shall make sure that any overridden methods
+ * remain safe to call from multiple threads and do not change any public {@code NameSpace} state.
+ *
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.3 (derived from geotk-3.00)
* @version 0.3
* @module
*/
-@Immutable
public class DefaultNameSpace implements NameSpace, Serializable {
/**
* For cross-version compatibility.
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecordType.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecordType.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecordType.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecordType.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -29,7 +29,6 @@ import org.opengis.util.Record;
import org.opengis.util.RecordType;
import org.opengis.util.RecordSchema;
import org.apache.sis.util.Debug;
-import org.apache.sis.util.Immutable;
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.internal.util.CollectionsExt;
@@ -48,12 +47,17 @@ import org.apache.sis.internal.jdk7.Obje
* {@code RecordType} instances can be though as equivalent to instances of the Java {@link Class} class.
* The set of members in a {@code RecordType} can be though as equivalent to the set of fields in a class.
*
+ * {@section Immutability and thread safety}
+ * This class is immutable and thus inherently thread-safe if the {@link TypeName} and {@link RecordSchema} arguments,
+ * as well as all ({@link MemberName}, {@link Type}) entries in the map given to the constructor, are also immutable.
+ * Subclasses shall make sure that any overridden methods remain safe to call from multiple threads and do not change
+ * any public {@code RecordType} state.
+ *
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.3
* @version 0.3
* @module
*/
-@Immutable
@XmlType(name = "RecordType")
public class DefaultRecordType implements RecordType, Serializable {
/**
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultScopedName.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultScopedName.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultScopedName.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultScopedName.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -26,7 +26,6 @@ import org.opengis.util.LocalName;
import org.opengis.util.ScopedName;
import org.opengis.util.GenericName;
import org.opengis.util.InternationalString;
-import org.apache.sis.util.Immutable;
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.internal.util.UnmodifiableArrayList;
@@ -43,12 +42,17 @@ import org.apache.sis.internal.util.Unmo
* <li>{@link DefaultNameFactory#parseGenericName(NameSpace, CharSequence)} with at least one separator</li>
* </ul>
*
+ * {@section Immutability and thread safety}
+ * This class is immutable and thus inherently thread-safe if the {@link NameSpace} and all {@link CharSequence}
+ * elements in the arguments given to the constructor are also immutable. Subclasses shall make sure that any
+ * overridden methods remain safe to call from multiple threads and do not change any public {@code LocalName}
+ * state.
+ *
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.3 (derived from geotk-2.1)
* @version 0.3
* @module
*/
-@Immutable
@XmlType(name = "ScopedName") // Actually 'gml:CodeType', but the later is used elsewhere.
@XmlRootElement(name = "ScopedName")
public class DefaultScopedName extends AbstractName implements ScopedName {
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultTypeName.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultTypeName.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultTypeName.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultTypeName.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -19,7 +19,6 @@ package org.apache.sis.util.iso;
import javax.xml.bind.annotation.XmlRootElement;
import org.opengis.util.TypeName;
import org.opengis.util.NameSpace;
-import org.apache.sis.util.Immutable;
/**
@@ -30,13 +29,17 @@ import org.apache.sis.util.Immutable;
* <li>{@link DefaultNameFactory#createTypeName(NameSpace, CharSequence)}</li>
* </ul>
*
+ * {@section Immutability and thread safety}
+ * This class is immutable and thus inherently thread-safe if the {@link NameSpace} and {@link CharSequence}
+ * arguments given to the constructor are also immutable. Subclasses shall make sure that any overridden methods
+ * remain safe to call from multiple threads and do not change any public {@code TypeName} state.
+ *
* @author Guilhem Legal (Geomatys)
* @author Cédric Briançon (Geomatys)
* @since 0.3 (derived from geotk-3.00)
* @version 0.3
* @module
*/
-@Immutable
@XmlRootElement(name = "TypeName")
public class DefaultTypeName extends DefaultLocalName implements TypeName {
/**
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/GlobalNameSpace.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/GlobalNameSpace.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/GlobalNameSpace.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/GlobalNameSpace.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -17,7 +17,6 @@
package org.apache.sis.util.iso;
import java.io.ObjectStreamException;
-import org.apache.sis.util.Immutable;
/**
@@ -25,12 +24,14 @@ import org.apache.sis.util.Immutable;
* any global namespace in public API since ISO 19103 does not define them and users should not
* need to handle them explicitely.
*
+ * {@section Immutability and thread safety}
+ * This class is immutable and thus inherently thread-safe.
+ *
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.3 (derived from geotk-3.00)
* @version 0.3
* @module
*/
-@Immutable
final class GlobalNameSpace extends DefaultNameSpace {
/**
* For cross-version compatibility.
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/ResourceInternationalString.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/ResourceInternationalString.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/ResourceInternationalString.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/ResourceInternationalString.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -21,7 +21,6 @@ import java.util.Locale;
import java.util.Properties;
import java.util.ResourceBundle;
import java.util.MissingResourceException;
-import org.apache.sis.util.Immutable;
import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
@@ -72,6 +71,11 @@ import static org.apache.sis.util.Argume
* international strings with the same functionality than this {@code ResourceInternationalString}.
* See {@link org.apache.sis.util.resources} for more information.
*
+ * {@section Immutability and thread safety}
+ * This class is immutable and thus inherently thread-safe if the bundles created by {@link #getBundle(Locale)}
+ * is also immutable. Subclasses may or may not be immutable, at implementation choice. But implementors are
+ * encouraged to make sure that subclasses remain immutable for more predictable behavior.
+ *
* @author Martin Desruisseaux (IRD, Geomatys)
* @author Johann Sorel (Geomatys)
* @since 0.3 (derived from geotk-2.1)
@@ -80,7 +84,6 @@ import static org.apache.sis.util.Argume
*
* @see ResourceBundle#getBundle(String, Locale)
*/
-@Immutable
public class ResourceInternationalString extends AbstractInternationalString implements Serializable {
/**
* Serial number for inter-operability with different versions.
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/SimpleInternationalString.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/SimpleInternationalString.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/SimpleInternationalString.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/SimpleInternationalString.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -21,7 +21,6 @@ import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.Locale;
-import org.apache.sis.util.Immutable;
import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
@@ -39,12 +38,16 @@ import org.apache.sis.internal.jdk7.Obje
* the {@link #SimpleInternationalString(String)} constructor is okay. Otherwise use
* the {@link Types#toInternationalString(CharSequence)} method.
*
+ * {@section Immutability and thread safety}
+ * This class is immutable and thus inherently thread-safe.
+ * Subclasses may or may not be immutable, at implementation choice. But implementors are
+ * encouraged to make sure that subclasses remain immutable for more predictable behavior.
+ *
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.3 (derived from geotk-2.1)
* @version 0.3
* @module
*/
-@Immutable
public class SimpleInternationalString extends AbstractInternationalString implements Serializable {
/**
* Serial number for inter-operability with different versions.
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/logging/LoggerFactory.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/logging/LoggerFactory.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/logging/LoggerFactory.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/logging/LoggerFactory.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -17,7 +17,6 @@
package org.apache.sis.util.logging;
import java.util.logging.Logger;
-import org.apache.sis.util.ThreadSafe;
import org.apache.sis.util.collection.WeakValueHashMap;
@@ -38,6 +37,10 @@ import org.apache.sis.util.collection.We
* The {@link #getLogger(String)} method shall return some {@link Logger} subclass
* (typically {@link LoggerAdapter}) which forwards directly all log methods to the other framework.
*
+ * {@section Thread safety}
+ * This base class is safe for multi-threads usage. Subclasses registered in {@code META-INF/services/}
+ * shall make sure that any overridden methods remain safe to call from multiple threads.
+ *
* @param <L> The type of loggers used for the implementation backend.
* This is the type used by external frameworks like Log4J.
*
@@ -49,7 +52,6 @@ import org.apache.sis.util.collection.We
* @see Logging
* @see LoggerAdapter
*/
-@ThreadSafe
public abstract class LoggerFactory<L> {
/**
* The logger class. We ask for this information right at construction time in order to
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/logging/MonolineFormatter.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/logging/MonolineFormatter.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/logging/MonolineFormatter.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/logging/MonolineFormatter.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -36,7 +36,6 @@ import org.apache.sis.io.LineAppender;
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.CharSequences;
import org.apache.sis.util.Configuration;
-import org.apache.sis.util.ThreadSafe;
import org.apache.sis.util.Debug;
// Related to JDK7
@@ -102,6 +101,11 @@ import org.apache.sis.internal.jdk7.JDK7
* java.util.logging.ConsoleHandler.level = FINE
* }
*
+ * {@section Thread safety}
+ * The same {@code MonolineFormatter} instance can be safely used by many threads without synchronization
+ * on the part of the caller. Subclasses should make sure that any overridden methods remain safe to call
+ * from multiple threads.
+ *
* @author Martin Desruisseaux (Geomatys)
* @since 0.3 (derived from geotk-2.0)
* @version 0.4
@@ -110,7 +114,6 @@ import org.apache.sis.internal.jdk7.JDK7
* @see SimpleFormatter
* @see Handler#setFormatter(Formatter)
*/
-@ThreadSafe
public class MonolineFormatter extends Formatter {
/** Do not format source class name. */ private static final int NO_SOURCE = 0;
/** Format the source logger without base. */ private static final int LOGGER_SHORT = 1;
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListeners.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListeners.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListeners.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListeners.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -22,7 +22,6 @@ import java.util.logging.Logger;
import java.util.logging.LogRecord;
import java.util.NoSuchElementException;
import org.apache.sis.util.Localized;
-import org.apache.sis.util.ThreadSafe;
import org.apache.sis.util.Exceptions;
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.resources.Errors;
@@ -42,6 +41,11 @@ import org.apache.sis.util.resources.Err
* <li>Otherwise the warning is logged to the logger returned by {@link #getLogger()}.</li>
* </ul>
*
+ * {@section Thread safety}
+ * The same {@code WarningListeners} instance can be safely used by many threads without synchronization
+ * on the part of the caller. Subclasses should make sure that any overridden methods remain safe to call
+ * from multiple threads.
+ *
* @param <S> The type of the source of warnings.
*
* @author Martin Desruisseaux (Geomatys)
@@ -52,7 +56,6 @@ import org.apache.sis.util.resources.Err
* @see WarningListener
* @see org.apache.sis.storage.DataStore#listeners
*/
-@ThreadSafe
public class WarningListeners<S> implements Localized {
/**
* The declared source of warnings. This is not necessarily the real source,
@@ -166,8 +169,7 @@ public class WarningListeners<S> impleme
trace = Thread.currentThread().getStackTrace();
record = new LogRecord(Level.WARNING, message);
}
- for (int i=0; i<trace.length; i++) {
- StackTraceElement e = trace[i];
+ for (final StackTraceElement e : trace) {
if (isPublic(e)) {
record.setSourceClassName(e.getClassName());
record.setSourceMethodName(e.getMethodName());
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -546,6 +546,11 @@ public final class Errors extends Indexe
public static final short NullArgument_1 = 95;
/**
+ * ‘{0}’ collection does not accept null elements.
+ */
+ public static final short NullCollectionElement_1 = 134;
+
+ /**
* Null key is not allowed in this dictionary.
*/
public static final short NullMapKey = 96;
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties [ISO-8859-1] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties [ISO-8859-1] Thu Dec 26 06:03:57 2013
@@ -120,6 +120,7 @@ NoSuchElement_1 = Elem
NoSuchProperty_2 = No property named \u201c{0}\u201d has been found in \u201c{1}\u201d.
NoUnit = No unit of measurement has been specified.
NullArgument_1 = Argument \u2018{0}\u2019 shall not be null.
+NullCollectionElement_1 = \u2018{0}\u2019 collection does not accept null elements.
# Use the OGC/ISO "Dictionary" word instead of "Map" for avoiding confusion with geographic map.
NullMapKey = Null key is not allowed in this dictionary.
NullMapValue = Null values are not allowed in this dictionary.
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties [ISO-8859-1] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties [ISO-8859-1] Thu Dec 26 06:03:57 2013
@@ -110,6 +110,7 @@ NoSuchElement_1 = L\u2
NoSuchProperty_2 = Aucune propri\u00e9t\u00e9 nomm\u00e9e \u201c{0}\u201d n\u2019a \u00e9t\u00e9 trouv\u00e9e dans \u201c{1}\u201d.
NoUnit = Aucune unit\u00e9 de mesure n\u2019a \u00e9t\u00e9 sp\u00e9cifi\u00e9e.
NullArgument_1 = L\u2019argument \u2018{0}\u2019 ne doit pas \u00eatre nul.
+NullCollectionElement_1 = La collection \u2018{0}\u2019 n\u2019accepte pas les valeurs nulles.
NullMapKey = La cl\u00e9 nulle n\u2019est pas autoris\u00e9e dans ce dictionnaire.
NullMapValue = Les valeurs nulles ne sont pas autoris\u00e9es dans ce dictionnaire.
OddArrayLength_1 = La longueur du tableau est {0}, alors qu\u2019on attendait une longueur paire.
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -33,7 +33,6 @@ import org.opengis.util.InternationalStr
import org.apache.sis.util.Debug;
import org.apache.sis.util.Classes;
import org.apache.sis.util.Localized;
-import org.apache.sis.util.ThreadSafe;
import org.apache.sis.util.Exceptions;
import org.apache.sis.util.CharSequences;
import org.apache.sis.util.iso.Types;
@@ -63,12 +62,16 @@ import org.apache.sis.internal.jdk7.JDK7
* <li>{@link Class} and {@link Throwable} instances are summarized.</li>
* </ul>
*
+ * {@section Thread safety}
+ * The same {@code IndexedResourceBundle} instance can be safely used by many threads without synchronization
+ * on the part of the caller. Subclasses should make sure that any overridden methods remain safe to call from
+ * multiple threads.
+ *
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.3 (derived from geotk-1.2)
* @version 0.4
* @module
*/
-@ThreadSafe
public class IndexedResourceBundle extends ResourceBundle implements Localized {
/**
* Maximum string length for text inserted into another text. This parameter is used by
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/ResourceInternationalString.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/ResourceInternationalString.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/ResourceInternationalString.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/ResourceInternationalString.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -23,7 +23,6 @@ import java.io.InvalidObjectException;
import java.io.IOException;
import java.util.Locale;
import java.util.MissingResourceException;
-import org.apache.sis.util.Immutable;
import org.apache.sis.util.Utilities;
import org.apache.sis.util.iso.AbstractInternationalString;
@@ -36,12 +35,14 @@ import org.apache.sis.internal.jdk7.Obje
* {@link IndexedResourceBundle}. Compared to the public class, this specialization works
* with integer resource keys and accepts arguments.
*
+ * {@section Immutability and thread safety}
+ * This base class is immutable and thus inherently thread-safe.
+ *
* @author Martin Desruisseaux (Geomatys)
* @since 0.3
* @version 0.4
* @module
*/
-@Immutable
abstract class ResourceInternationalString extends AbstractInternationalString implements Serializable {
/**
* Serial number for inter-operability with different versions.
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/MarshallerPool.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/MarshallerPool.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/MarshallerPool.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/MarshallerPool.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -25,7 +25,6 @@ import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
-import org.apache.sis.util.ThreadSafe;
import org.apache.sis.util.logging.Logging;
import org.apache.sis.internal.system.DelayedExecutor;
import org.apache.sis.internal.system.DelayedRunnable;
@@ -50,6 +49,11 @@ import org.apache.sis.util.ArgumentCheck
* The (un)marshallers created by this class can optionally by configured with the SIS-specific
* properties defined in the {@link XML} class, in addition to JAXB standard properties.
*
+ * {@section Thread safety}
+ * The same {@code MarshallerPool} instance can be safely used by many threads without synchronization
+ * on the part of the caller. Subclasses should make sure that any overridden methods remain safe to call
+ * from multiple threads.
+ *
* @author Martin Desruisseaux (Geomatys)
* @since 0.3 (derived from geotk-3.00)
* @version 0.3
@@ -58,7 +62,6 @@ import org.apache.sis.util.ArgumentCheck
* @see XML
* @see <a href="http://jaxb.java.net/guide/Performance_and_thread_safety.html">JAXB Performance and thread-safety</a>
*/
-@ThreadSafe
public class MarshallerPool {
/**
* The indentation string, fixed to 2 spaces instead of 4 because ISO/OGC XML are very verbose.
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -27,6 +27,28 @@ import org.apache.sis.util.ArgumentCheck
/**
* Lists some namespaces URLs used by JAXB when (un)marshalling.
*
+ * <p><strong>Warning: string constants in this class may change in any SIS version.</strong>
+ * Those constants are made available for applications who wish to use the same URLs than SIS
+ * in their own JAXB annotations. Note that applications using those constants will have their
+ * URLs determined by the SIS version available at compile-time, not runtime, because the
+ * {@code javac} compiler inlines string constants.</p>
+ *
+ * <p>The following table lists the URLs, their usual prefix, and the SIS versions when each URL changed.</p>
+ * <table class="sis">
+ * <tr><th>Prefix</th> <th>XML Namespace</th> <th>Changes history</th></tr>
+ * <tr><td>gco</td> <td>{@value #GCO}</td> <td></td></tr>
+ * <tr><td>gfc</td> <td>{@value #GFC}</td> <td></td></tr>
+ * <tr><td>gmd</td> <td>{@value #GMD}</td> <td></td></tr>
+ * <tr><td>gmi</td> <td>{@value #GMI}</td> <td></td></tr>
+ * <tr><td>srv</td> <td>{@value #SRV}</td> <td></td></tr>
+ * <tr><td>gts</td> <td>{@value #GTS}</td> <td></td></tr>
+ * <tr><td>gmx</td> <td>{@value #GMX}</td> <td></td></tr>
+ * <tr><td>gml</td> <td>{@value #GML}</td> <td>0.4</td></tr>
+ * <tr><td>csw</td> <td>{@value #CSW}</td> <td></td></tr>
+ * <tr><td>xsi</td> <td>{@value #XSI}</td> <td></td></tr>
+ * <tr><td>xlink</td> <td>{@value #XLINK}</td> <td></td></tr>
+ * </table>
+ *
* {@section Profiles}
* Some countries or organizations define profiles of international standards, which may contain
* country-specific extensions. The namespace of such extensions are usually defined in a separated
@@ -109,7 +131,13 @@ public final class Namespaces extends St
/**
* The <code>{@value}</code> URL.
* The usual prefix for this namespace is {@code "gml"}.
- * The current version is 3.2 (ISO 19136), but this may change in any future SIS release.
+ * The 3.2 version is equivalent to ISO 19136.
+ *
+ * <p>History</p>
+ * <table class="sis">
+ * <tr><th>SIS version</th> <th>URL</th></tr>
+ * <tr><td>0.3</td> <td>http://www.opengis.net/gml</td></tr>
+ * </table>
*
* @category OGC
*/
@@ -118,7 +146,6 @@ public final class Namespaces extends St
/**
* The <code>{@value}</code> URL.
* The usual prefix for this namespace is {@code "csw"}.
- * The current version is 2.0.2, but this may change in any future SIS release.
*
* @category OGC
*/
@@ -126,6 +153,7 @@ public final class Namespaces extends St
/**
* The <code>{@value}</code> URL.
+ * The usual prefix for this namespace is {@code "xsi"}.
* This is also defined by {@link XMLConstants#W3C_XML_SCHEMA_INSTANCE_NS_URI}.
*
* @category W3C
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/NilReason.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/NilReason.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/NilReason.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/NilReason.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -23,7 +23,6 @@ import java.io.Serializable;
import java.lang.reflect.Proxy;
import java.lang.reflect.InvocationHandler;
import org.opengis.util.InternationalString;
-import org.apache.sis.util.Immutable;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.CharSequences;
@@ -50,6 +49,9 @@ import org.apache.sis.internal.jaxb.Prim
* {@code NilReason} is used in a number of XML elements where it is necessary to permit
* one of the above values as an alternative to the primary element.
*
+ * {@section Immutability and thread safety}
+ * This final class is immutable and thus inherently thread-safe.
+ *
* @author Martin Desruisseaux (Geomatys)
* @since 0.3 (derived from geotk-3.18)
* @version 0.4
@@ -57,7 +59,6 @@ import org.apache.sis.internal.jaxb.Prim
*
* @see NilObject
*/
-@Immutable
public final class NilReason implements Serializable {
/**
* For cross-version compatibility.
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/OGCNamespacePrefixMapper.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/OGCNamespacePrefixMapper.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/OGCNamespacePrefixMapper.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/OGCNamespacePrefixMapper.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -17,7 +17,6 @@
package org.apache.sis.xml;
import com.sun.xml.internal.bind.marshaller.NamespacePrefixMapper;
-import org.apache.sis.util.Immutable;
/**
@@ -29,6 +28,9 @@ import org.apache.sis.util.Immutable;
* bundled with JAXB 2.1. Even with working {@code @XmlSchema} annotations, this mapper still
* a convenient may to gain more control like choosing a default namespace at runtime.
*
+ * {@section Immutability and thread safety}
+ * This final class is immutable and thus inherently thread-safe.
+ *
* @author Cédric Briançon (Geomatys)
* @since 0.3 (derived from geotk-2.5)
* @version 0.3
@@ -37,7 +39,6 @@ import org.apache.sis.util.Immutable;
* @see <a href="http://java.sun.com/webservices/docs/1.5/jaxb/vendorProperties.html">JAXB extensions</a>
* @see <a href="https://issues.apache.org/jira/browse/SIS-74">SIS-74</a>
*/
-@Immutable
final class OGCNamespacePrefixMapper extends NamespacePrefixMapper {
/**
* If non-null, this namespace will be the default namespace (the one without prefix).
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/OGCNamespacePrefixMapper_Endorsed.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/OGCNamespacePrefixMapper_Endorsed.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/OGCNamespacePrefixMapper_Endorsed.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/OGCNamespacePrefixMapper_Endorsed.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -17,7 +17,6 @@
package org.apache.sis.xml;
import com.sun.xml.bind.marshaller.NamespacePrefixMapper;
-import org.apache.sis.util.Immutable;
/**
@@ -27,12 +26,14 @@ import org.apache.sis.util.Immutable;
* the package name of the parent {@code NamespacePrefixMapper} class does not have
* the "{@code internal}" part.
*
+ * {@section Immutability and thread safety}
+ * This final class is immutable and thus inherently thread-safe.
+ *
* @author Cédric Briançon (Geomatys)
* @since 0.3 (derived from geotk-2.5)
* @version 0.3
* @module
*/
-@Immutable
final class OGCNamespacePrefixMapper_Endorsed extends NamespacePrefixMapper {
/**
* If non-null, this namespace will be the default namespace (the one without prefix).
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/PooledMarshaller.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/PooledMarshaller.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/PooledMarshaller.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/PooledMarshaller.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -35,7 +35,6 @@ import javax.xml.transform.Result;
import javax.xml.validation.Schema;
import org.xml.sax.ContentHandler;
import org.w3c.dom.Node;
-import org.apache.sis.util.Decorator;
import org.apache.sis.internal.jaxb.Context;
import org.apache.sis.internal.system.XMLOutputFactory;
@@ -58,7 +57,6 @@ import org.apache.sis.internal.system.XM
* @version 0.4
* @module
*/
-@Decorator(Marshaller.class)
final class PooledMarshaller extends Pooled implements Marshaller {
/**
* The wrapper marshaller which does the real work.
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/PooledUnmarshaller.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/PooledUnmarshaller.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/PooledUnmarshaller.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/PooledUnmarshaller.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -38,7 +38,6 @@ import javax.xml.transform.Source;
import javax.xml.validation.Schema;
import org.w3c.dom.Node;
import org.xml.sax.InputSource;
-import org.apache.sis.util.Decorator;
import org.apache.sis.internal.jaxb.Context;
import org.apache.sis.internal.system.XMLInputFactory;
@@ -61,7 +60,6 @@ import org.apache.sis.internal.system.XM
* @version 0.4
* @module
*/
-@Decorator(Unmarshaller.class)
final class PooledUnmarshaller extends Pooled implements Unmarshaller {
/**
* The wrapper marshaller which does the real work.
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/XLink.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/XLink.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/XLink.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/XLink.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -25,7 +25,6 @@ import javax.xml.bind.annotation.XmlAttr
import javax.xml.bind.annotation.XmlTransient;
import org.opengis.util.InternationalString;
import org.apache.sis.util.Classes;
-import org.apache.sis.util.ThreadSafe;
import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.resources.Errors;
@@ -79,7 +78,6 @@ import org.apache.sis.internal.jdk7.Obje
* @see <a href="http://www.w3.org/TR/xlink/">XML Linking Language</a>
* @see <a href="http://schemas.opengis.net/xlink/1.0.0/xlinks.xsd">OGC schema</a>
*/
-@ThreadSafe
@XmlTransient
public class XLink implements Serializable {
/**
@@ -342,7 +340,7 @@ public class XLink implements Serializab
* @return The type of link, or {@code null}.
*/
@XmlAttribute(name = "type", namespace = Namespaces.XLINK, required = true)
- public synchronized Type getType() {
+ public Type getType() {
if (type != Type.AUTO) {
return type;
}
@@ -380,7 +378,7 @@ public class XLink implements Serializab
*
* @param type The new type of link, or {@code null} if none.
*/
- public synchronized void setType(final Type type) {
+ public void setType(final Type type) {
canWrite(0x1, "type", "type"); // We want a non-null value in all cases.
if (type != null && (fieldMask() & ~type.fieldMask) != 0) {
throw new IllegalStateException(Errors.format(Errors.Keys.InconsistentAttribute_2, "type", type.identifier()));
@@ -428,7 +426,7 @@ public class XLink implements Serializab
* @category locator
*/
@XmlAttribute(name = "href", namespace = Namespaces.XLINK)
- public synchronized URI getHRef() {
+ public URI getHRef() {
return href;
}
@@ -442,7 +440,7 @@ public class XLink implements Serializab
*
* @category locator
*/
- public synchronized void setHRef(final URI href) throws IllegalStateException {
+ public void setHRef(final URI href) throws IllegalStateException {
canWrite(0x2, "href", href);
this.href = href;
}
@@ -455,7 +453,7 @@ public class XLink implements Serializab
* @category semantic
*/
@XmlAttribute(name = "role", namespace = Namespaces.XLINK)
- public synchronized URI getRole() {
+ public URI getRole() {
return role;
}
@@ -469,7 +467,7 @@ public class XLink implements Serializab
*
* @category semantic
*/
- public synchronized void setRole(final URI role) throws IllegalStateException {
+ public void setRole(final URI role) throws IllegalStateException {
canWrite(0x4, "role", role);
this.role = role;
}
@@ -482,7 +480,7 @@ public class XLink implements Serializab
* @category semantic
*/
@XmlAttribute(name = "arcrole", namespace = Namespaces.XLINK)
- public synchronized URI getArcRole() {
+ public URI getArcRole() {
return arcrole;
}
@@ -496,7 +494,7 @@ public class XLink implements Serializab
*
* @category semantic
*/
- public synchronized void setArcRole(final URI arcrole) throws IllegalStateException {
+ public void setArcRole(final URI arcrole) throws IllegalStateException {
canWrite(0x8, "arcrole", arcrole);
this.arcrole = arcrole;
}
@@ -509,7 +507,7 @@ public class XLink implements Serializab
* @category semantic
*/
@XmlAttribute(name = "title", namespace = Namespaces.XLINK)
- public synchronized InternationalString getTitle() {
+ public InternationalString getTitle() {
return title;
}
@@ -524,7 +522,7 @@ public class XLink implements Serializab
*
* @category semantic
*/
- public synchronized void setTitle(final InternationalString title) throws IllegalStateException {
+ public void setTitle(final InternationalString title) throws IllegalStateException {
canWrite(0x10, "title", title);
this.title = title;
}
@@ -585,7 +583,7 @@ public class XLink implements Serializab
* @category behavior
*/
@XmlAttribute(name = "show", namespace = Namespaces.XLINK)
- public synchronized Show getShow() {
+ public Show getShow() {
return show;
}
@@ -599,7 +597,7 @@ public class XLink implements Serializab
*
* @category behavior
*/
- public synchronized void setShow(final Show show) throws IllegalStateException {
+ public void setShow(final Show show) throws IllegalStateException {
canWrite(0x20, "show", show);
this.show = show;
}
@@ -656,7 +654,7 @@ public class XLink implements Serializab
* @category behavior
*/
@XmlAttribute(name = "actuate", namespace = Namespaces.XLINK)
- public synchronized Actuate getActuate() {
+ public Actuate getActuate() {
return actuate;
}
@@ -671,7 +669,7 @@ public class XLink implements Serializab
*
* @category behavior
*/
- public synchronized void setActuate(final Actuate actuate) throws IllegalStateException {
+ public void setActuate(final Actuate actuate) throws IllegalStateException {
canWrite(0x40, "actuate", actuate);
this.actuate = actuate;
}
@@ -683,7 +681,7 @@ public class XLink implements Serializab
*
* @category traversal
*/
- public synchronized String getLabel() {
+ public String getLabel() {
return label;
}
@@ -697,7 +695,7 @@ public class XLink implements Serializab
*
* @category traversal
*/
- public synchronized void setLabel(final String label) throws IllegalStateException {
+ public void setLabel(final String label) throws IllegalStateException {
canWrite(0x80, "label", label);
this.label = label;
}
@@ -710,7 +708,7 @@ public class XLink implements Serializab
*
* @category traversal
*/
- public synchronized String getFrom() {
+ public String getFrom() {
return from;
}
@@ -725,7 +723,7 @@ public class XLink implements Serializab
*
* @category traversal
*/
- public synchronized void setFrom(final String from) throws IllegalStateException {
+ public void setFrom(final String from) throws IllegalStateException {
canWrite(0x100, "from", from);
this.from = from;
}
@@ -738,7 +736,7 @@ public class XLink implements Serializab
*
* @category traversal
*/
- public synchronized String getTo() {
+ public String getTo() {
return to;
}
@@ -753,7 +751,7 @@ public class XLink implements Serializab
*
* @category traversal
*/
- public synchronized void setTo(final String to) throws IllegalStateException {
+ public void setTo(final String to) throws IllegalStateException {
canWrite(0x200, "to", to);
this.to = to;
}
@@ -764,7 +762,7 @@ public class XLink implements Serializab
*
* <p>After the first call to this method, any subsequent calls have no effect.</p>
*/
- public synchronized void freeze() {
+ public void freeze() {
if (hashCode == 0) {
hashCode = hash();
}
@@ -776,7 +774,7 @@ public class XLink implements Serializab
* @param object The object to compare with this XLink.
*/
@Override
- public synchronized boolean equals(final Object object) {
+ public boolean equals(final Object object) {
if (object == this) {
return true;
}
@@ -807,7 +805,7 @@ public class XLink implements Serializab
* Returns a hash code value for this XLink.
*/
@Override
- public synchronized int hashCode() {
+ public int hashCode() {
int hash = hashCode;
if (hash == 0) {
hash = hash();
@@ -837,7 +835,7 @@ public class XLink implements Serializab
* }
*/
@Override
- public synchronized String toString() {
+ public String toString() {
final StringBuilder buffer = new StringBuilder(64);
buffer.append(Classes.getShortClassName(this)).append('[');
append(buffer, "type", getType());
Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/internal/util/CheckedArrayListTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/internal/util/CheckedArrayListTest.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/internal/util/CheckedArrayListTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/internal/util/CheckedArrayListTest.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -67,7 +67,7 @@ public final strictfp class CheckedArray
list.add(null);
} catch (NullArgumentException e) {
final String message = e.getMessage();
- assertTrue("element", message.contains("element"));
+ assertTrue(message.contains("CheckedArrayList<String>"));
}
}
@@ -82,7 +82,7 @@ public final strictfp class CheckedArray
list.addAll(toAdd);
} catch (NullArgumentException e) {
final String message = e.getMessage();
- assertTrue("element", message.contains("element"));
+ assertTrue(message.contains("CheckedArrayList<String>"));
}
}
Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/io/EchoAppendable.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/io/EchoAppendable.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/io/EchoAppendable.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/io/EchoAppendable.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -17,7 +17,6 @@
package org.apache.sis.io;
import java.io.IOException;
-import org.apache.sis.util.Decorator;
import static org.junit.Assert.*;
@@ -33,7 +32,6 @@ import static org.junit.Assert.*;
* @version 0.3
* @module
*/
-@Decorator(Appendable.class)
public class EchoAppendable extends Appender {
/**
* The echo writer.
@@ -54,6 +52,8 @@ public class EchoAppendable extends Appe
/**
* Writes a single character.
*
+ * @param c The character to append.
+ * @return {@code this}.
* @throws IOException If an I/O error occurs.
*/
@Override
@@ -67,6 +67,7 @@ public class EchoAppendable extends Appe
* Writes a character sequence.
*
* @param sequence The character sequence to be written.
+ * @return {@code this}.
* @throws IOException If an I/O error occurs.
*/
@Override
@@ -82,6 +83,7 @@ public class EchoAppendable extends Appe
* @param sequence The character sequence to be written.
* @param start Index from which to start reading characters.
* @param end Index of the character following the last character to read.
+ * @return {@code this}.
* @throws IOException If an I/O error occurs.
*/
@Override
Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/measure/UnitsTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/measure/UnitsTest.java?rev=1553457&r1=1553456&r2=1553457&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/measure/UnitsTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/measure/UnitsTest.java [UTF-8] Thu Dec 26 06:03:57 2013
@@ -50,7 +50,8 @@ import static org.apache.sis.test.Assert
*/
@DependsOn({
SexagesimalConverterTest.class,
- org.apache.sis.internal.util.URIParserTest.class
+ org.apache.sis.internal.util.DefinitionURITest.class,
+ org.apache.sis.internal.util.XPathsTest.class
})
public final strictfp class UnitsTest extends TestCase {
/**