sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1822268 [6/7] - in /sis/trunk: ./ application/sis-console/src/main/java/org/apache/sis/console/ application/sis-javafx/ core/sis-build-helper/ core/sis-build-helper/src/main/java/org/apache/sis/internal/doclet/ core/sis-build-helper/src/ma...
Date Fri, 26 Jan 2018 10:48:29 GMT
Modified: sis/trunk/storage/sis-shapefile/src/test/java/org/apache/sis/internal/shapefile/jdbc/sql/WhereClauseTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-shapefile/src/test/java/org/apache/sis/internal/shapefile/jdbc/sql/WhereClauseTest.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-shapefile/src/test/java/org/apache/sis/internal/shapefile/jdbc/sql/WhereClauseTest.java [UTF-8] (original)
+++ sis/trunk/storage/sis-shapefile/src/test/java/org/apache/sis/internal/shapefile/jdbc/sql/WhereClauseTest.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -69,11 +69,7 @@ public class WhereClauseTest extends Abs
      */
     @Test
     public void whereCondition_field_literal_int() throws SQLException {
-        checkAndCount("FNODE_ < 2000", new ResultSetPredicate<ResultSet>() {
-            @Override public boolean test(ResultSet rs) throws SQLException {
-                return rs.getInt("FNODE_") < 2000;
-            }
-        }, 3);
+        checkAndCount("FNODE_ < 2000", rs -> rs.getInt("FNODE_") < 2000, 3);
     }
 
     /**
@@ -82,11 +78,7 @@ public class WhereClauseTest extends Abs
      */
     @Test
     public void whereCondition_field_literal_double() throws SQLException {
-        checkAndCount("SHAPE_LEN < 70.5", new ResultSetPredicate<ResultSet>() {
-            @Override public boolean test(ResultSet rs) throws SQLException {
-                return rs.getDouble("SHAPE_LEN") < 70.5;
-            }
-        }, 3);
+        checkAndCount("SHAPE_LEN < 70.5", rs -> rs.getDouble("SHAPE_LEN") < 70.5, 3);
     }
 
     /**
@@ -95,11 +87,7 @@ public class WhereClauseTest extends Abs
      */
     @Test
     public void whereCondition_field_literal_string() throws SQLException {
-        checkAndCount("FNAME = '36TH'", new ResultSetPredicate<ResultSet>() {
-            @Override public boolean test(ResultSet rs) throws SQLException {
-                return rs.getString("FNAME").equals("36TH");
-            }
-        }, 1);
+        checkAndCount("FNAME = '36TH'", rs -> rs.getString("FNAME").equals("36TH"), 1);
     }
 
     /**
@@ -108,11 +96,7 @@ public class WhereClauseTest extends Abs
      */
     @Test
     public void whereCondition_field_field() throws SQLException {
-        checkAndCount("FNODE_ < TNODE_", new ResultSetPredicate<ResultSet>() {
-            @Override public boolean test(ResultSet rs) throws SQLException {
-                return rs.getInt("FNODE_") < rs.getInt("TNODE_");
-            }
-        }, 1);
+        checkAndCount("FNODE_ < TNODE_", rs -> rs.getInt("FNODE_") < rs.getInt("TNODE_"), 1);
     }
 
     /**
@@ -120,6 +104,7 @@ public class WhereClauseTest extends Abs
      * unhandlable by a simple Predicate.
      * @param <T> Type used.
      */
+    @FunctionalInterface
     public interface ResultSetPredicate<T> {
         /**
          * Test a condition.

Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/MetadataBuilder.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/MetadataBuilder.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/MetadataBuilder.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/MetadataBuilder.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -116,10 +116,9 @@ import static java.util.Collections.sing
 import static org.apache.sis.internal.util.StandardDateFormat.MILLISECONDS_PER_DAY;
 
 // Branch-dependent imports
+import java.time.LocalDate;
 import org.opengis.metadata.citation.ResponsibleParty;
 import org.opengis.metadata.identification.CharacterSet;
-import org.apache.sis.internal.jdk8.LocalDate;
-import org.apache.sis.internal.jdk8.JDK8;
 import org.apache.sis.feature.DefaultFeatureType;
 import org.apache.sis.metadata.iso.citation.DefaultResponsibleParty;
 
@@ -831,12 +830,7 @@ public class MetadataBuilder {
      */
     private Citation sharedCitation(final InternationalString title) {
         if (title == null) return null;
-        Citation c = (Citation) sharedValues.get(title);
-        if (c == null) {
-            c = new DefaultCitation(title);
-            sharedValues.put(title, c);
-        }
-        return c;
+        return (Citation) sharedValues.computeIfAbsent(title, k -> new DefaultCitation((CharSequence) k));
     }
 
     /**
@@ -849,7 +843,7 @@ public class MetadataBuilder {
      */
     private Identifier sharedIdentifier(final CharSequence authority, final String code) {
         final DefaultIdentifier id = new DefaultIdentifier(sharedCitation(trim(authority)), code);
-        return (Identifier) JDK8.getOrDefault(sharedValues, id, id);
+        return (Identifier) sharedValues.getOrDefault(id, id);
     }
 
     /**
@@ -2672,7 +2666,7 @@ parse:      for (int i = 0; i < length;)
      * @return  the same value, but as an existing instance if possible.
      */
     public final Double shared(final Double value) {
-        final Object existing = JDK8.putIfAbsent(sharedValues, value, value);
+        final Object existing = sharedValues.putIfAbsent(value, value);
         return (existing != null) ? (Double) existing : value;
     }
 
@@ -2685,7 +2679,7 @@ parse:      for (int i = 0; i < length;)
      * @return  the same value, but as an existing instance if possible.
      */
     public final Integer shared(final Integer value) {
-        final Object existing = JDK8.putIfAbsent(sharedValues, value, value);
+        final Object existing = sharedValues.putIfAbsent(value, value);
         return (existing != null) ? (Integer) existing : value;
     }
 }

Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/FeatureIterator.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/FeatureIterator.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/FeatureIterator.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/FeatureIterator.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -24,9 +24,9 @@ import org.apache.sis.util.ObjectConvert
 import org.apache.sis.util.collection.BackingStoreException;
 
 // Branch-dependent imports
-import org.apache.sis.internal.jdk8.Spliterator;
-import org.apache.sis.internal.jdk8.Consumer;
-import org.apache.sis.internal.jdk8.DateTimeException;
+import java.util.Spliterator;
+import java.util.function.Consumer;
+import java.time.DateTimeException;
 import org.apache.sis.feature.AbstractFeature;
 import org.apache.sis.feature.AbstractIdentifiedType;
 import org.apache.sis.feature.DefaultAttributeType;

Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/MovingFeatureIterator.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/MovingFeatureIterator.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/MovingFeatureIterator.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/MovingFeatureIterator.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -23,9 +23,9 @@ import java.io.IOException;
 import org.apache.sis.internal.feature.MovingFeature;
 
 // Branch-dependent imports
-import org.apache.sis.internal.jdk8.Instant;
-import org.apache.sis.internal.jdk8.DateTimeException;
-import org.apache.sis.internal.jdk8.Consumer;
+import java.time.Instant;
+import java.time.DateTimeException;
+import java.util.function.Consumer;
 import org.apache.sis.feature.AbstractAttribute;
 import org.apache.sis.feature.AbstractFeature;
 
@@ -141,11 +141,7 @@ final class MovingFeatureIterator extend
             if (!mfIdRef.equals(identifier)) {
                 publish    = identifier;
                 identifier = mfIdRef;
-                builder    = builders.get(mfIdRef);
-                if (builder == null) {
-                    builder = new MovingFeature(np);
-                    builders.put(mfIdRef, builder);
-                }
+                builder    = builders.computeIfAbsent(mfIdRef, (k) -> new MovingFeature(np));
             }
             builder.addTimeRange(startTime, endTime);
             for (int i=0; i<np; i++) {

Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -19,6 +19,7 @@ package org.apache.sis.internal.storage.
 import java.util.List;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.Date;
 import java.util.Locale;
 import java.util.logging.Level;
 import java.util.logging.LogRecord;
@@ -70,10 +71,10 @@ import org.apache.sis.io.InvalidSeekExce
 import org.apache.sis.measure.Units;
 
 // Branch-dependent imports
-import org.apache.sis.internal.jdk8.Instant;
-import org.apache.sis.internal.jdk8.DateTimeException;
-import org.apache.sis.internal.jdk8.Stream;
-import org.apache.sis.internal.jdk8.StreamSupport;
+import java.time.Instant;
+import java.time.DateTimeException;
+import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
 import org.apache.sis.feature.AbstractFeature;
 import org.apache.sis.feature.AbstractIdentifiedType;
 
@@ -451,7 +452,7 @@ final class Store extends URIDataStore i
                     temporal = TimeEncoding.DEFAULT.crs();
                     timeEncoding = TimeEncoding.ABSOLUTE;
                 } else {
-                    temporal = builder.createTemporalCRS(startTime.toDate(), timeUnit);
+                    temporal = builder.createTemporalCRS(Date.from(startTime), timeUnit);
                     timeEncoding = new TimeEncoding(temporal.getDatum(), timeUnit);
                 }
                 components[count++] = temporal;
@@ -685,6 +686,7 @@ final class Store extends URIDataStore i
      * @todo Need to reset the position when doing another pass on the features. See {@link #rewind()}.
      * @todo If sequential order, publish Feature as soon as identifier changed.
      */
+    @Override
     public final synchronized Stream<AbstractFeature> features(final boolean parallel) throws DataStoreException {
         /*
          * If the user asks for one feature instance per line, then we can return a FeatureIter instance directly.
@@ -701,7 +703,7 @@ final class Store extends URIDataStore i
         } catch (IOException | IllegalArgumentException | DateTimeException e) {
             throw new DataStoreException(canNotParseFile(), e);
         }
-        return Stream.create(movingFeatures);
+        return movingFeatures.stream();
     }
 
     /**

Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/TimeEncoding.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/TimeEncoding.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/TimeEncoding.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/TimeEncoding.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -25,7 +25,7 @@ import org.apache.sis.referencing.Common
 import org.apache.sis.measure.Units;
 
 // Branch-dependent imports
-import org.apache.sis.internal.jdk8.Instant;
+import java.time.Instant;
 
 
 /**

Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/Store.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/Store.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/Store.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/Store.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -48,9 +48,7 @@ import org.apache.sis.internal.storage.M
 import org.apache.sis.internal.storage.Resources;
 
 // Branch-dependent imports
-import org.apache.sis.internal.jdk8.JDK8;
-import org.apache.sis.internal.jdk8.UncheckedIOException;
-import org.apache.sis.storage.ReadOnlyStorageException;
+import java.io.UncheckedIOException;
 
 
 /**
@@ -252,7 +250,7 @@ final class Store extends DataStore impl
                          * At this point we got the data store. It could happen that a store for
                          * the same file has been added concurrently, so we need to check again.
                          */
-                        final DataStore existing = JDK8.putIfAbsent(children, real, next);
+                        final DataStore existing = children.putIfAbsent(real, next);
                         if (existing != null) {
                             next.close();
                             next = existing;
@@ -307,29 +305,6 @@ final class Store extends DataStore impl
     }
 
     /**
-     * Returns an error message for a read-only data store.
-     */
-    private String readOnly() {
-        return Resources.forLocale(getLocale()).getString(Resources.Keys.StoreIsReadOnly);
-    }
-
-    /**
-     * Unsupported operation in current version.
-     */
-    @Override
-    public Resource add(Resource resource) throws ReadOnlyStorageException {
-        throw new ReadOnlyStorageException(readOnly());
-    }
-
-    /**
-     * Unsupported operation in current version.
-     */
-    @Override
-    public void remove(Resource resource) throws ReadOnlyStorageException {
-        throw new ReadOnlyStorageException(readOnly());
-    }
-
-    /**
      * Closes all children resources.
      */
     @Override

Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ChannelDataInput.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ChannelDataInput.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ChannelDataInput.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ChannelDataInput.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -36,9 +36,6 @@ import org.apache.sis.util.Debug;
 
 import static org.apache.sis.util.ArgumentChecks.ensureBetween;
 
-// Branch-dependent imports
-import org.apache.sis.internal.jdk8.JDK8;
-
 
 /**
  * Provides convenience methods for working with a ({@link ReadableByteChannel}, {@link ByteBuffer}) pair.
@@ -261,7 +258,7 @@ public class ChannelDataInput extends Ch
      * @throws IOException if an error (including EOF) occurred while reading the stream.
      */
     public final byte readByte() throws IOException {
-        ensureBufferContains(Byte.SIZE / Byte.SIZE);
+        ensureBufferContains(Byte.BYTES);
         return buffer.get();
     }
 
@@ -277,7 +274,7 @@ public class ChannelDataInput extends Ch
      * @throws IOException if an error (including EOF) occurred while reading the stream.
      */
     public final int readUnsignedByte() throws IOException {
-        return JDK8.toUnsignedInt(readByte());
+        return Byte.toUnsignedInt(readByte());
     }
 
     /**
@@ -289,7 +286,7 @@ public class ChannelDataInput extends Ch
      * @throws IOException if an error (including EOF) occurred while reading the stream.
      */
     public final short readShort() throws IOException {
-        ensureBufferContains(Short.SIZE / Byte.SIZE);
+        ensureBufferContains(Short.BYTES);
         return buffer.getShort();
     }
 
@@ -305,7 +302,7 @@ public class ChannelDataInput extends Ch
      * @throws IOException if an error (including EOF) occurred while reading the stream.
      */
     public final int readUnsignedShort() throws IOException {
-        return readShort() & 0xFFFF;
+        return Short.toUnsignedInt(readShort());
     }
 
     /**
@@ -317,7 +314,7 @@ public class ChannelDataInput extends Ch
      * @throws IOException if an error (including EOF) occurred while reading the stream.
      */
     public final char readChar() throws IOException {
-        ensureBufferContains(Character.SIZE / Byte.SIZE);
+        ensureBufferContains(Character.BYTES);
         return buffer.getChar();
     }
 
@@ -330,7 +327,7 @@ public class ChannelDataInput extends Ch
      * @throws IOException if an error (including EOF) occurred while reading the stream.
      */
     public final int readInt() throws IOException {
-        ensureBufferContains(Integer.SIZE / Byte.SIZE);
+        ensureBufferContains(Integer.BYTES);
         return buffer.getInt();
     }
 
@@ -346,7 +343,7 @@ public class ChannelDataInput extends Ch
      * @throws IOException if an error (including EOF) occurred while reading the stream.
      */
     public final long readUnsignedInt() throws IOException {
-        return readInt() & 0xFFFFFFFFL;
+        return Integer.toUnsignedLong(readInt());
     }
 
     /**
@@ -358,7 +355,7 @@ public class ChannelDataInput extends Ch
      * @throws IOException if an error (including EOF) occurred while reading the stream.
      */
     public final long readLong() throws IOException {
-        ensureBufferContains(Long.SIZE / Byte.SIZE);
+        ensureBufferContains(Long.BYTES);
         return buffer.getLong();
     }
 
@@ -371,7 +368,7 @@ public class ChannelDataInput extends Ch
      * @throws IOException if an error (including EOF) occurred while reading the stream.
      */
     public final float readFloat() throws IOException {
-        ensureBufferContains(Float.SIZE / Byte.SIZE);
+        ensureBufferContains(Float.BYTES);
         return buffer.getFloat();
     }
 
@@ -384,7 +381,7 @@ public class ChannelDataInput extends Ch
      * @throws IOException if an error (including EOF) occurred while reading the stream.
      */
     public final double readDouble() throws IOException {
-        ensureBufferContains(Double.SIZE / Byte.SIZE);
+        ensureBufferContains(Double.BYTES);
         return buffer.getDouble();
     }
 
@@ -845,7 +842,7 @@ public class ChannelDataInput extends Ch
      */
     @Override
     public final void seek(final long position) throws IOException {
-        long p = JDK8.subtractExact(position, bufferOffset);
+        long p = Math.subtractExact(position, bufferOffset);
         if (p >= 0 && p <= buffer.limit()) {
             /*
              * Requested position is inside the current limits of the buffer.
@@ -858,7 +855,7 @@ public class ChannelDataInput extends Ch
              * that StorageConnector.rewind() needs the buffer content to be
              * valid as a result of this seek, so we reload it immediately.
              */
-            ((SeekableByteChannel) channel).position(JDK8.addExact(channelOffset, position));
+            ((SeekableByteChannel) channel).position(Math.addExact(channelOffset, position));
             bufferOffset = position;
             buffer.clear().limit(0);
         } else if (p >= 0) {

Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ChannelDataOutput.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ChannelDataOutput.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ChannelDataOutput.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ChannelDataOutput.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -33,9 +33,6 @@ import org.apache.sis.internal.storage.R
 
 import static org.apache.sis.util.ArgumentChecks.ensureBetween;
 
-// Branch-dependent imports
-import org.apache.sis.internal.jdk8.JDK8;
-
 
 /**
  * Provides convenience methods for working with a ({@link WritableByteChannel}, {@link ByteBuffer}) pair.
@@ -222,7 +219,7 @@ public class ChannelDataOutput extends C
      * @throws IOException if some I/O exception occurs during writing.
      */
     public final void writeByte(final int value) throws IOException {
-        ensureBufferAccepts(Byte.SIZE / Byte.SIZE);
+        ensureBufferAccepts(Byte.BYTES);
         buffer.put((byte) value);
     }
 
@@ -236,7 +233,7 @@ public class ChannelDataOutput extends C
      * @throws IOException if some I/O exception occurs during writing.
      */
     public final void writeShort(final int value) throws IOException {
-        ensureBufferAccepts(Short.SIZE / Byte.SIZE);
+        ensureBufferAccepts(Short.BYTES);
         buffer.putShort((short) value);
     }
 
@@ -249,7 +246,7 @@ public class ChannelDataOutput extends C
      * @throws IOException if some I/O exception occurs during writing.
      */
     public final void writeChar(final int value) throws IOException {
-        ensureBufferAccepts(Character.SIZE / Byte.SIZE);
+        ensureBufferAccepts(Character.BYTES);
         buffer.putChar((char) value);
     }
 
@@ -262,7 +259,7 @@ public class ChannelDataOutput extends C
      * @throws IOException if some I/O exception occurs during writing.
      */
     public final void writeInt(final int value) throws IOException {
-        ensureBufferAccepts(Integer.SIZE / Byte.SIZE);
+        ensureBufferAccepts(Integer.BYTES);
         buffer.putInt(value);
     }
 
@@ -275,7 +272,7 @@ public class ChannelDataOutput extends C
      * @throws IOException if some I/O exception occurs during writing.
      */
     public final void writeLong(final long value) throws IOException {
-        ensureBufferAccepts(Long.SIZE / Byte.SIZE);
+        ensureBufferAccepts(Long.BYTES);
         buffer.putLong(value);
     }
 
@@ -288,7 +285,7 @@ public class ChannelDataOutput extends C
      * @throws IOException if some I/O exception occurs during writing.
      */
     public final void writeFloat(final float value) throws IOException {
-        ensureBufferAccepts(Float.SIZE / Byte.SIZE);
+        ensureBufferAccepts(Float.BYTES);
         buffer.putFloat(value);
     }
 
@@ -301,7 +298,7 @@ public class ChannelDataOutput extends C
      * @throws IOException if some I/O exception occurs during writing.
      */
     public final void writeDouble(final double value) throws IOException {
-        ensureBufferAccepts(Double.SIZE / Byte.SIZE);
+        ensureBufferAccepts(Double.BYTES);
         buffer.putDouble(value);
     }
 
@@ -501,7 +498,7 @@ public class ChannelDataOutput extends C
             private CharBuffer view;
             @Override Buffer createView() {return view = buffer.asCharBuffer();}
             @Override void transfer(int offset, int n) {view.put(src, offset, n);}
-        }.writeFully(Character.SIZE / Byte.SIZE, offset, length);
+        }.writeFully(Character.BYTES, offset, length);
     }
 
     /**
@@ -517,7 +514,7 @@ public class ChannelDataOutput extends C
             private ShortBuffer view;
             @Override Buffer createView() {return view = buffer.asShortBuffer();}
             @Override void transfer(int offset, int length) {view.put(src, offset, length);}
-        }.writeFully(Short.SIZE / Byte.SIZE, offset, length);
+        }.writeFully(Short.BYTES, offset, length);
     }
 
     /**
@@ -533,7 +530,7 @@ public class ChannelDataOutput extends C
             private IntBuffer view;
             @Override Buffer createView() {return view = buffer.asIntBuffer();}
             @Override void transfer(int offset, int n) {view.put(src, offset, n);}
-        }.writeFully(Integer.SIZE / Byte.SIZE, offset, length);
+        }.writeFully(Integer.BYTES, offset, length);
     }
 
     /**
@@ -549,7 +546,7 @@ public class ChannelDataOutput extends C
             private LongBuffer view;
             @Override Buffer createView() {return view = buffer.asLongBuffer();}
             @Override void transfer(int offset, int n) {view.put(src, offset, n);}
-        }.writeFully(Long.SIZE / Byte.SIZE, offset, length);
+        }.writeFully(Long.BYTES, offset, length);
     }
 
     /**
@@ -565,7 +562,7 @@ public class ChannelDataOutput extends C
             private FloatBuffer view;
             @Override Buffer createView() {return view = buffer.asFloatBuffer();}
             @Override void transfer(int offset, int n) {view.put(src, offset, n);}
-        }.writeFully(Float.SIZE / Byte.SIZE, offset, length);
+        }.writeFully(Float.BYTES, offset, length);
     }
 
     /**
@@ -581,7 +578,7 @@ public class ChannelDataOutput extends C
             private DoubleBuffer view;
             @Override Buffer createView() {return view = buffer.asDoubleBuffer();}
             @Override void transfer(int offset, int n) {view.put(src, offset, n);}
-        }.writeFully(Double.SIZE / Byte.SIZE, offset, length);
+        }.writeFully(Double.BYTES, offset, length);
     }
 
     /**
@@ -610,7 +607,7 @@ public class ChannelDataOutput extends C
      */
     @Override
     public final void seek(final long position) throws IOException {
-        long p = JDK8.subtractExact(position, bufferOffset);
+        long p = Math.subtractExact(position, bufferOffset);
         if (p >= 0 && p <= buffer.limit()) {
             /*
              * Requested position is inside the current limits of the buffer.
@@ -623,7 +620,7 @@ public class ChannelDataOutput extends C
              * but we can set the new position directly in the channel.
              */
             flush();
-            ((SeekableByteChannel) channel).position(JDK8.addExact(channelOffset, position));
+            ((SeekableByteChannel) channel).position(Math.addExact(channelOffset, position));
             bufferOffset = position;
         } else if (p >= 0) {
             /*

Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ChannelFactory.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ChannelFactory.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ChannelFactory.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ChannelFactory.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -133,7 +133,7 @@ public abstract class ChannelFactory {
          */
         final Set<OpenOption> optionSet;
         if (options == null || options.length == 0) {
-            optionSet = Collections.<OpenOption>singleton(StandardOpenOption.READ);
+            optionSet = Collections.singleton(StandardOpenOption.READ);
         } else {
             optionSet = new HashSet<>(Arrays.asList(options));
             optionSet.add(StandardOpenOption.READ);

Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ChannelImageInputStream.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ChannelImageInputStream.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ChannelImageInputStream.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ChannelImageInputStream.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -25,9 +25,6 @@ import java.nio.channels.SeekableByteCha
 import javax.imageio.stream.IIOByteBuffer;
 import javax.imageio.stream.ImageInputStream;
 
-// Branch-dependent imports
-import org.apache.sis.internal.jdk8.JDK8;
-
 
 /**
  * Adds the missing methods in {@code ChannelDataInput} for implementing the {@code ImageInputStream} interface.
@@ -196,7 +193,7 @@ loop:   while ((c = read()) >= 0) {
      */
     @Override
     public final int read() throws IOException {
-        return hasRemaining() ? JDK8.toUnsignedInt(buffer.get()) : -1;
+        return hasRemaining() ? Byte.toUnsignedInt(buffer.get()) : -1;
     }
 
     /**

Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/IOUtilities.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/IOUtilities.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/IOUtilities.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/IOUtilities.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -47,9 +47,6 @@ import org.apache.sis.util.Static;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.internal.storage.Resources;
 
-// Branch-dependent imports
-import org.apache.sis.internal.jdk8.JDK8;
-
 
 /**
  * Utility methods related to I/O operations. Many methods in this class accept arbitrary {@link Object} argument
@@ -228,7 +225,7 @@ public final class IOUtilities extends S
                 }
                 for (final byte b : path.substring(i, i+n).getBytes(StandardCharsets.UTF_8)) {
                     buffer.append('%');
-                    final String hex = Integer.toHexString(JDK8.toUnsignedInt(b)).toUpperCase(Locale.ROOT);
+                    final String hex = Integer.toHexString(Byte.toUnsignedInt(b)).toUpperCase(Locale.ROOT);
                     if (hex.length() < 2) {
                         buffer.append('0');
                     }

Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/InputStreamAdapter.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/InputStreamAdapter.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/InputStreamAdapter.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/InputStreamAdapter.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -21,7 +21,7 @@ import java.io.IOException;
 import javax.imageio.stream.ImageInputStream;
 
 // Branch-dependent imports
-import org.apache.sis.internal.jdk8.UncheckedIOException;
+import java.io.UncheckedIOException;
 
 
 /**

Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/Region.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/Region.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/Region.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/Region.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -16,9 +16,6 @@
  */
 package org.apache.sis.internal.storage.io;
 
-// Branch-dependent imports
-import org.apache.sis.internal.jdk8.JDK8;
-
 
 /**
  * A sub-area in a <var>n</var>-dimensional hyper-rectangle, optionally with sub-sampling.
@@ -106,7 +103,7 @@ public final class Region {
             final long upper = lower + ((count-1) * step + 1);
             final long span  = size[i];
             assert (count > 0) && (lower >= 0) && (upper > lower) && (upper <= span) : i;
-            targetSize[i] = JDK8.toIntExact(count);
+            targetSize[i] = Math.toIntExact(count);
 
             position += stride * lower;
             skip     += stride * (span - (upper - lower));
@@ -141,6 +138,6 @@ public final class Region {
         for (int i=0; i<dimension; i++) {
             length *= targetSize[i];
         }
-        return JDK8.toIntExact(length);
+        return Math.toIntExact(length);
     }
 }

Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/Aggregate.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/Aggregate.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/Aggregate.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/Aggregate.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -19,6 +19,7 @@ package org.apache.sis.storage;
 import java.util.Collection;
 import org.opengis.metadata.Metadata;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
+import org.apache.sis.internal.storage.Resources;
 
 
 /**
@@ -108,12 +109,16 @@ public interface Aggregate extends Resou
      * then this {@code Aggregate} may throw an exception.
      * </div>
      *
+     * <p>The default implementation throws {@link ReadOnlyStorageException}.</p>
+     *
      * @param  resource  the resource to copy in this {@code Aggregate}.
      * @return the effectively added resource. May be {@code resource} itself if it has been added verbatim.
      * @throws ReadOnlyStorageException if this instance does not support write operations.
      * @throws DataStoreException if the given resource can not be stored in this {@code Aggregate} for another reason.
      */
-    Resource add(Resource resource) throws ReadOnlyStorageException, DataStoreException;
+    default Resource add(Resource resource) throws ReadOnlyStorageException, DataStoreException {
+        throw new ReadOnlyStorageException(this, Resources.Keys.StoreIsReadOnly);
+    }
 
     /**
      * Removes a {@code Resource} from this {@code Aggregate}.
@@ -125,5 +130,7 @@ public interface Aggregate extends Resou
      * @throws ReadOnlyStorageException if this instance does not support write operations.
      * @throws DataStoreException if the given resource could not be removed for another reason.
      */
-    void remove(Resource resource) throws ReadOnlyStorageException, DataStoreException;
+    default void remove(Resource resource) throws ReadOnlyStorageException, DataStoreException {
+        throw new ReadOnlyStorageException(this, Resources.Keys.StoreIsReadOnly);
+    }
 }

Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStore.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStore.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStore.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStore.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -283,7 +283,7 @@ public abstract class DataStore implemen
      */
     public Resource findResource(final String identifier) throws DataStoreException {
         ArgumentChecks.ensureNonEmpty("identifier", identifier);
-        final Resource resource = findResource(identifier, this, new IdentityHashMap<Resource,Boolean>());
+        final Resource resource = findResource(identifier, this, new IdentityHashMap<>());
         if (resource != null) {
             return resource;
         }

Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreRegistry.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreRegistry.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreRegistry.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreRegistry.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -95,10 +95,6 @@ final class DataStoreRegistry {
                         return providers.next();
                     }
                 }
-
-                @Override public void remove() {
-                    throw new UnsupportedOperationException();
-                }
             });
         }
     }

Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/FeatureNaming.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/FeatureNaming.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/FeatureNaming.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/FeatureNaming.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -28,9 +28,6 @@ import org.apache.sis.util.resources.Voc
 import org.apache.sis.internal.util.CollectionsExt;
 import org.apache.sis.internal.storage.Resources;
 
-// Branch-dependent imports
-import org.apache.sis.internal.jdk8.JDK8;
-
 
 /**
  * Helper class for mapping {@link GenericName} instances and their shortened names to features.
@@ -222,7 +219,7 @@ public class FeatureNaming<E> {
                 if (!fullNames.contains(alias)) {
                     values.remove(alias);
                 }
-            } else if (JDK8.putIfAbsent(values, alias, value) != null) {
+            } else if (values.putIfAbsent(alias, value) != null) {
                 /*
                  * If a value already existed for that alias but the alias was not declared in the 'aliases' map,
                  * this means that the list was implicitly Collections.singletonList(key). Since we now have an
@@ -279,7 +276,7 @@ public class FeatureNaming<E> {
             } else if (remaining.size() == 1) {
                 final String select = remaining.get(0);
                 assert !select.equals(key) : select;     // Should have been removed by removeFromMultiValuesMap(…).
-                error |= (JDK8.putIfAbsent(values, alias, values.get(select)) != null);
+                error |= (values.putIfAbsent(alias, values.get(select)) != null);
             }
         }
         if (error) {

Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/FeatureSet.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/FeatureSet.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/FeatureSet.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/FeatureSet.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -16,7 +16,14 @@
  */
 package org.apache.sis.storage;
 
+import java.util.Iterator;
+import org.apache.sis.internal.storage.Resources;
+
 // Branch-dependent imports
+import java.util.function.Predicate;
+import java.util.function.UnaryOperator;
+import java.util.stream.Stream;
+import org.apache.sis.feature.AbstractFeature;
 import org.apache.sis.feature.DefaultFeatureType;
 
 
@@ -44,7 +51,7 @@ public interface FeatureSet extends Data
      *   <li>{@linkplain org.opengis.referencing.crs.CoordinateReferenceSystem Coordinate Reference System}.</li>
      * </ul>
      *
-     * All features returned by {@code features(boolean)} will be either of that type, or a sub-type of it.
+     * All features returned by {@link #features(boolean)} will be either of that type, or a sub-type of it.
      *
      * <div class="note"><b>Relationship with metadata:</b>
      * if subtypes exist, their list may be obtained from the {@linkplain #getMetadata() metadata} like below
@@ -68,6 +75,40 @@ public interface FeatureSet extends Data
     DefaultFeatureType getType() throws DataStoreException;
 
     /**
+     * Requests a subset of features and feature properties from this resource.
+     * The filtering can be applied in two domains:
+     *
+     * <ul>
+     *   <li>The returned {@code FeatureSet} may contain a smaller number of {@code Feature} instances.</li>
+     *   <li>In each {@code Feature} instance of the returned set, the number of
+     *       {@linkplain org.apache.sis.feature.DefaultFeatureType#getProperty properties} may be smaller.</li>
+     * </ul>
+     *
+     * While it is technically possible to return a <em>transformed</em> feature set (i.e. containing feature
+     * properties not found in this original {@code FeatureSet}, for example as a result of some computation),
+     * such usages should be rare. Transformations should be the topic of a separated processing package.
+     * This {@code subset(Query)} method is rather for allowing {@link DataStore} implementations to optimize
+     * the overall filtering by using the tools available with their format (for example an R-tree).
+     * {@code BoundingBox} filters are the most common case of optimization implemented by {@link DataStore}.
+     *
+     * <p>The returned subset may be a <em>view</em> of this set, i.e. changes in this {@code FeatureSet}
+     * may be reflected immediately on the returned subset (and conversely), but not necessarily.
+     * However the returned subset may not have the same capabilities as this {@link FeatureSet}.
+     * In particular, write operations may become unsupported after complex queries.</p>
+     *
+     * <p>The default implementation throws {@link UnsupportedQueryException}.</p>
+     *
+     * @param  query  definition of feature and feature properties filtering applied at reading time.
+     * @return resulting subset of features (never {@code null}).
+     * @throws UnsupportedQueryException if this {@code FeatureSet} can not execute the given query.
+     *         This includes query validation errors.
+     * @throws DataStoreException if another error occurred while processing the query.
+     */
+    default FeatureSet subset(Query query) throws UnsupportedQueryException, DataStoreException {
+        throw new UnsupportedQueryException();
+    }
+
+    /**
      * Returns a stream of all features contained in this dataset.
      * For all features, the following condition shall be true:
      *
@@ -98,5 +139,64 @@ public interface FeatureSet extends Data
      * @return all features contained in this dataset.
      * @throws DataStoreException if an error occurred while creating the stream.
      */
-//  Stream<Feature> features(boolean parallel) throws DataStoreException;
+    Stream<AbstractFeature> features(boolean parallel) throws DataStoreException;
+
+    /**
+     * Inserts new features in this {@code FeatureSet}.
+     * Any feature already present in the {@link FeatureSet} will remain unmodified.
+     *
+     * <div class="note"><b>API note:</b>
+     * this method expects an {@link Iterator} rather then a {@link java.util.stream.Stream} for easing
+     * inter-operability with various API. Implementing a custom {@link Iterator} requires less effort
+     * than implementing a {@link Stream}. On the other side if the user has a {@link Stream},
+     * obtaining an {@link Iterator} can be done by a call to {@link Stream#iterator()}.</div>
+     *
+     * <p>The default implementation throws {@link ReadOnlyStorageException}.</p>
+     *
+     * @param  features features to insert in this {@code FeatureSet}.
+     * @throws ReadOnlyStorageException if this instance does not support write operations.
+     * @throws DataStoreException if another error occurred while storing new features.
+     */
+    default void add(Iterator<? extends AbstractFeature> features) throws ReadOnlyStorageException, DataStoreException {
+        throw new ReadOnlyStorageException(this, Resources.Keys.StoreIsReadOnly);
+    }
+
+    /**
+     * Removes all features from this {@code FeatureSet} which matches the given predicate.
+     *
+     * <p>The default implementation throws {@link ReadOnlyStorageException}.</p>
+     *
+     * @param  filter  a predicate which returns true for resources to be removed.
+     * @return {@code true} if any elements were removed.
+     * @throws ReadOnlyStorageException if this instance does not support write operations.
+     * @throws DataStoreException if another error occurred while removing features.
+     */
+    default boolean removeIf(Predicate<? super AbstractFeature> filter) throws ReadOnlyStorageException, DataStoreException {
+        throw new ReadOnlyStorageException(this, Resources.Keys.StoreIsReadOnly);
+    }
+
+    /**
+     * Updates all features from this {@code FeatureSet} which matches the given predicate.
+     * For each {@code Feature} instance matching the given {@link Predicate},
+     * the <code>{@linkplain UnaryOperator#apply UnaryOperator.apply(Feature)}</code> method will be invoked.
+     * {@code UnaryOperator}s are free to modify the given {@code Feature} <i>in-place</i> or to return a
+     * different feature instance. Two behaviors are possible:
+     * <ul>
+     *   <li>If the operator returns a non-null {@code Feature}, then the modified feature is stored
+     *       in replacement of the previous feature (not necessarily at the same location).</li>
+     *   <li>If the operator returns {@code null}, then the feature will be removed from the {@code FeatureSet}.</li>
+     * </ul>
+     *
+     * <p>The default implementation throws {@link ReadOnlyStorageException}.</p>
+     *
+     * @param  filter   a predicate which returns true for resources to be updated.
+     * @param  updater  operation called for each matching {@code Feature}.
+     * @throws ReadOnlyStorageException if this instance does not support write operations.
+     * @throws DataStoreException if another error occurred while replacing features.
+     */
+    default void replaceIf(Predicate<? super AbstractFeature> filter, UnaryOperator<AbstractFeature> updater)
+            throws ReadOnlyStorageException, DataStoreException
+    {
+        throw new ReadOnlyStorageException(this, Resources.Keys.StoreIsReadOnly);
+    }
 }

Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/Query.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/Query.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/Query.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/Query.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -44,6 +44,8 @@ package org.apache.sis.storage;
  * @author Johann Sorel (Geomatys)
  * @version 0.8
  *
+ * @see FeatureSet#subset(Query)
+ *
  * @since 0.8
  * @module
  */

Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/StorageConnector.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/StorageConnector.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/StorageConnector.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/StorageConnector.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -59,9 +59,6 @@ import org.apache.sis.internal.util.Util
 import org.apache.sis.io.InvalidSeekException;
 import org.apache.sis.setup.OptionKey;
 
-// Branch-dependent imports
-import org.apache.sis.internal.jdk8.JDK8;
-
 
 /**
  * Information for creating a connection to a {@link DataStore} in read and/or write mode.
@@ -152,6 +149,7 @@ public class StorageConnector implements
      *
      * @param  <T>  the type of input created by this {@code Opener} instance.
      */
+    @FunctionalInterface
     private interface Opener<T> {
         /**
          * Invoked when first needed for creating an input of the requested type.
@@ -173,18 +171,15 @@ public class StorageConnector implements
      */
     private static final Map<Class<?>, Opener<?>> OPENERS = new IdentityHashMap<>(13);
     static {
-        /*
-         * NOTE: JDK8 branch uses lambda expressions.
-         */
-        add(String.class,           new Opener<String>()           {@Override public String           open(StorageConnector c)                  {return c.createString();}});
-        add(ByteBuffer.class,       new Opener<ByteBuffer>()       {@Override public ByteBuffer       open(StorageConnector c) throws Exception {return c.createByteBuffer();}});
-        add(DataInput.class,        new Opener<DataInput>()        {@Override public DataInput        open(StorageConnector c) throws Exception {return c.createDataInput();}});
-        add(ImageInputStream.class, new Opener<ImageInputStream>() {@Override public ImageInputStream open(StorageConnector c) throws Exception {return c.createImageInputStream();}});
-        add(InputStream.class,      new Opener<InputStream>()      {@Override public InputStream      open(StorageConnector c) throws Exception {return c.createInputStream();}});
-        add(Reader.class,           new Opener<Reader>()           {@Override public Reader           open(StorageConnector c) throws Exception {return c.createReader();}});
-        add(Connection.class,       new Opener<Connection>()       {@Override public Connection       open(StorageConnector c) throws Exception {return c.createConnection();}});
-        add(ChannelDataInput.class, new Opener<ChannelDataInput>() {@Override public ChannelDataInput open(StorageConnector c) throws Exception {return c.createChannelDataInput(false);}});
-        add(ChannelFactory.class,   new Opener<ChannelFactory>()   {@Override public ChannelFactory   open(StorageConnector c)                  {return null;}});
+        add(String.class,           StorageConnector::createString);
+        add(ByteBuffer.class,       StorageConnector::createByteBuffer);
+        add(DataInput.class,        StorageConnector::createDataInput);
+        add(ImageInputStream.class, StorageConnector::createImageInputStream);
+        add(InputStream.class,      StorageConnector::createInputStream);
+        add(Reader.class,           StorageConnector::createReader);
+        add(Connection.class,       StorageConnector::createConnection);
+        add(ChannelDataInput.class, (s) -> s.createChannelDataInput(false));    // Undocumented case (SIS internal)
+        add(ChannelFactory.class,   (s) -> null);                               // Undocumented. Shall not cache.
         /*
          * ChannelFactory may have been created as a side effect of creating a ReadableByteChannel.
          * Caller should have asked for another type (e.g. InputStream) before to ask for that type.
@@ -1082,7 +1077,7 @@ public class StorageConnector implements
                     final ByteBuffer buffer = (ByteBuffer) c.view;
                     final int p = buffer.limit();
                     final long mark = input.getStreamPosition();
-                    input.seek(JDK8.addExact(mark, p));
+                    input.seek(Math.addExact(mark, p));
                     final int n = input.read(buffer.array(), p, buffer.capacity() - p);
                     input.seek(mark);
                     if (n > 0) {
@@ -1289,7 +1284,7 @@ public class StorageConnector implements
             Object v = c.view;
             if (v != view) {
                 if (v instanceof AutoCloseable) {
-                    JDK8.putIfAbsent(toClose, (AutoCloseable) v, Boolean.TRUE);     // Mark 'v' as needing to be closed.
+                    toClose.putIfAbsent((AutoCloseable) v, Boolean.TRUE);       // Mark 'v' as needing to be closed.
                 }
             } else {
                 /*

Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/UnsupportedQueryException.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/UnsupportedQueryException.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/UnsupportedQueryException.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/UnsupportedQueryException.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -23,6 +23,8 @@ package org.apache.sis.storage;
  * @author  Johann Sorel (Geomatys)
  * @version 0.8
  *
+ * @see FeatureSet#subset(Query)
+ *
  * @since 0.8
  * @module
  */

Modified: sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/csv/StoreTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/csv/StoreTest.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/csv/StoreTest.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/csv/StoreTest.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -37,12 +37,12 @@ import static org.apache.sis.test.TestUt
 import static org.apache.sis.test.TestUtilities.getSingleton;
 
 // Branch-dependent imports
+import java.time.Instant;
 import org.apache.sis.feature.AbstractFeature;
 import org.apache.sis.feature.AbstractIdentifiedType;
 import org.apache.sis.feature.DefaultAttributeType;
 import org.apache.sis.feature.DefaultFeatureType;
 import org.apache.sis.metadata.iso.identification.AbstractIdentification;
-import org.apache.sis.internal.jdk8.Instant;
 
 
 /**
@@ -78,7 +78,7 @@ public final strictfp class StoreTest ex
      * Returns the instant for the given time at the day of the test.
      */
     private static Instant instant(final String time) {
-        return Instant.ofEpochMilli(date("2012-01-17 " + time).getTime());
+        return date("2012-01-17 " + time).toInstant();
     }
 
     /**

Modified: sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/io/ChannelDataInputTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/io/ChannelDataInputTest.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/io/ChannelDataInputTest.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/io/ChannelDataInputTest.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -59,7 +59,7 @@ public final strictfp class ChannelDataI
         final byte[] array = createRandomArray(STREAM_LENGTH);
         referenceStream = new DataInputStream(new ByteArrayInputStream(array));
         testedStream = new ChannelDataInput("testAllReadMethods", new DripByteChannel(array, random, 1, 1024),
-                ByteBuffer.allocate(random.nextInt(BUFFER_MAX_CAPACITY) + (Double.SIZE / Byte.SIZE)), false);
+                ByteBuffer.allocate(random.nextInt(BUFFER_MAX_CAPACITY) + Double.BYTES), false);
         transferRandomData(testedStream, array.length - ARRAY_MAX_LENGTH, 16);
     }
 
@@ -90,42 +90,42 @@ public final strictfp class ChannelDataI
                 break;
             }
             case 10: {
-                final int n = random.nextInt(ARRAY_MAX_LENGTH / (Character.SIZE / Byte.SIZE));
+                final int n = random.nextInt(ARRAY_MAX_LENGTH / Character.BYTES);
                 final char[] tmp = new char[n];
                 for (int i=0; i<n; i++) tmp[i] = r.readChar();
                 assertArrayEquals("readChars(int)", tmp, t.readChars(n));
                 break;
             }
             case 11: {
-                final int n = random.nextInt(ARRAY_MAX_LENGTH / (Short.SIZE / Byte.SIZE));
+                final int n = random.nextInt(ARRAY_MAX_LENGTH / Short.BYTES);
                 final short[] tmp = new short[n];
                 for (int i=0; i<n; i++) tmp[i] = r.readShort();
                 assertArrayEquals("readShorts(int)", tmp, t.readShorts(n));
                 break;
             }
             case 12: {
-                final int n = random.nextInt(ARRAY_MAX_LENGTH / (Integer.SIZE / Byte.SIZE));
+                final int n = random.nextInt(ARRAY_MAX_LENGTH / Integer.BYTES);
                 final int[] tmp = new int[n];
                 for (int i=0; i<n; i++) tmp[i] = r.readInt();
                 assertArrayEquals("readInts(int)", tmp, t.readInts(n));
                 break;
             }
             case 13: {
-                final int n = random.nextInt(ARRAY_MAX_LENGTH / (Long.SIZE / Byte.SIZE));
+                final int n = random.nextInt(ARRAY_MAX_LENGTH / Long.BYTES);
                 final long[] tmp = new long[n];
                 for (int i=0; i<n; i++) tmp[i] = r.readLong();
                 assertArrayEquals("readLongs(int)", tmp, t.readLongs(n));
                 break;
             }
             case 14: {
-                final int n = random.nextInt(ARRAY_MAX_LENGTH / (Float.SIZE / Byte.SIZE));
+                final int n = random.nextInt(ARRAY_MAX_LENGTH / Float.BYTES);
                 final float[] tmp = new float[n];
                 for (int i=0; i<n; i++) tmp[i] = r.readFloat();
                 assertArrayEquals("readFloats(int)", tmp, t.readFloats(n), 0);
                 break;
             }
             case 15: {
-                final int n = random.nextInt(ARRAY_MAX_LENGTH / (Double.SIZE / Byte.SIZE));
+                final int n = random.nextInt(ARRAY_MAX_LENGTH / Double.BYTES);
                 final double[] tmp = new double[n];
                 for (int i=0; i<n; i++) tmp[i] = r.readDouble();
                 assertArrayEquals("readDoubles(int)", tmp, t.readDoubles(n), 0);
@@ -161,7 +161,7 @@ public final strictfp class ChannelDataI
     public void testSeekOnForwardOnlyChannel() throws IOException {
         int length = random.nextInt(2048) + 1024;
         final byte[] array = createRandomArray(length);
-        length -= (Long.SIZE / Byte.SIZE);                      // Safety against buffer underflow.
+        length -= Long.BYTES; // Safety against buffer underflow.
         final ByteBuffer buffer = ByteBuffer.wrap(array);
         final ChannelDataInput input = new ChannelDataInput("testSeekOnForwardOnlyChannel",
                 new DripByteChannel(array, random, 1, 2048),

Modified: sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/io/ChannelDataOutputTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/io/ChannelDataOutputTest.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/io/ChannelDataOutputTest.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/io/ChannelDataOutputTest.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -108,7 +108,7 @@ public strictfp class ChannelDataOutputT
      */
     @Test
     public void testAllWriteMethods() throws IOException {
-        initialize("testAllWriteMethods", STREAM_LENGTH, random.nextInt(BUFFER_MAX_CAPACITY) + (Double.SIZE / Byte.SIZE));
+        initialize("testAllWriteMethods", STREAM_LENGTH, random.nextInt(BUFFER_MAX_CAPACITY) + Double.BYTES);
         writeInStreams();
         assertStreamContentEquals();
     }
@@ -132,11 +132,11 @@ public strictfp class ChannelDataOutputT
     @Test
     @DependsOnMethod("testAllWriteMethods")
     public void testWriteAndSeek() throws IOException {
-        initialize("testWriteAndSeek", STREAM_LENGTH, random.nextInt(BUFFER_MAX_CAPACITY) + (Double.SIZE / Byte.SIZE));
+        initialize("testWriteAndSeek", STREAM_LENGTH, random.nextInt(BUFFER_MAX_CAPACITY) + Double.BYTES);
         writeInStreams();
         ((Closeable) referenceStream).close();
         final byte[] expectedArray = expectedData.toByteArray();
-        final int seekRange = expectedArray.length - (Long.SIZE / Byte.SIZE);
+        final int seekRange = expectedArray.length - Long.BYTES;
         final ByteBuffer arrayView = ByteBuffer.wrap(expectedArray);
         for (int i=0; i<100; i++) {
             final int position = random.nextInt(seekRange);
@@ -295,14 +295,14 @@ public strictfp class ChannelDataOutputT
                 break;
             }
             case 7: {
-                final byte[] tmp = new byte[random.nextInt(ARRAY_MAX_LENGTH / (Byte.SIZE / Byte.SIZE))];
+                final byte[] tmp = new byte[random.nextInt(ARRAY_MAX_LENGTH / Byte.BYTES)];
                 random.nextBytes(tmp);
                 r.write(tmp);
                 t.write(tmp);
                 break;
             }
             case 8: {
-                final char[] tmp = new char[random.nextInt(ARRAY_MAX_LENGTH / (Character.SIZE / Byte.SIZE))];
+                final char[] tmp = new char[random.nextInt(ARRAY_MAX_LENGTH / Character.BYTES)];
                 for (int i=0; i<tmp.length; i++) {
                     tmp[i] = (char) random.nextInt(1 << Character.SIZE);
                     if (!(r instanceof ImageOutputStream)) {
@@ -316,7 +316,7 @@ public strictfp class ChannelDataOutputT
                 break;
             }
             case 9: {
-                final short[] tmp = new short[random.nextInt(ARRAY_MAX_LENGTH / (Short.SIZE / Byte.SIZE))];
+                final short[] tmp = new short[random.nextInt(ARRAY_MAX_LENGTH / Short.BYTES)];
                 for (int i=0; i<tmp.length; i++) {
                     tmp[i] = (short) random.nextInt(1 << Short.SIZE);
                     if (!(r instanceof ImageOutputStream)) {
@@ -330,7 +330,7 @@ public strictfp class ChannelDataOutputT
                 break;
             }
             case 10: {
-                final int[] tmp = new int[random.nextInt(ARRAY_MAX_LENGTH / (Integer.SIZE / Byte.SIZE))];
+                final int[] tmp = new int[random.nextInt(ARRAY_MAX_LENGTH / Integer.BYTES)];
                 for (int i=0; i<tmp.length; i++) {
                     tmp[i] = random.nextInt();
                     if (!(r instanceof ImageOutputStream)) {
@@ -344,7 +344,7 @@ public strictfp class ChannelDataOutputT
                 break;
             }
             case 11: {
-                final long[] tmp = new long[random.nextInt(ARRAY_MAX_LENGTH / (Long.SIZE / Byte.SIZE))];
+                final long[] tmp = new long[random.nextInt(ARRAY_MAX_LENGTH / Long.BYTES)];
                 for (int i=0; i<tmp.length; i++) {
                     tmp[i] = random.nextLong();
                     if (!(r instanceof ImageOutputStream)) {
@@ -358,7 +358,7 @@ public strictfp class ChannelDataOutputT
                 break;
             }
             case 12: {
-                final float[] tmp = new float[random.nextInt(ARRAY_MAX_LENGTH / (Float.SIZE / Byte.SIZE))];
+                final float[] tmp = new float[random.nextInt(ARRAY_MAX_LENGTH / Float.BYTES)];
                 for (int i=0; i<tmp.length; i++) {
                     tmp[i] = random.nextFloat();
                     if (!(r instanceof ImageOutputStream)) {
@@ -372,7 +372,7 @@ public strictfp class ChannelDataOutputT
                 break;
             }
             case 13: {
-                final double[] tmp = new double[random.nextInt(ARRAY_MAX_LENGTH / (Double.SIZE / Byte.SIZE))];
+                final double[] tmp = new double[random.nextInt(ARRAY_MAX_LENGTH / Double.BYTES)];
                 for (int i=0; i<tmp.length; i++) {
                     tmp[i] = random.nextDouble();
                     if (!(r instanceof ImageOutputStream)) {

Modified: sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/io/ChannelImageInputStreamTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/io/ChannelImageInputStreamTest.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/io/ChannelImageInputStreamTest.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/io/ChannelImageInputStreamTest.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -116,42 +116,42 @@ public final strictfp class ChannelImage
                 break;
             }
             case 15: {
-                final int length = random.nextInt(ARRAY_MAX_LENGTH / (Character.SIZE / Byte.SIZE));
+                final int length = random.nextInt(ARRAY_MAX_LENGTH / Character.BYTES);
                 final char[] expected = new char[length]; r.readFully(expected, 0, length);
                 final char[] actual   = new char[length]; t.readFully(actual,   0, length);
                 assertArrayEquals("readFully(char[])", expected, actual);
                 break;
             }
             case 16: {
-                final int length = random.nextInt(ARRAY_MAX_LENGTH / (Short.SIZE / Byte.SIZE));
+                final int length = random.nextInt(ARRAY_MAX_LENGTH / Short.BYTES);
                 final short[] expected = new short[length]; r.readFully(expected, 0, length);
                 final short[] actual   = new short[length]; t.readFully(actual,   0, length);
                 assertArrayEquals("readFully(short[])", expected, actual);
                 break;
             }
             case 17: {
-                final int length = random.nextInt(ARRAY_MAX_LENGTH / (Integer.SIZE / Byte.SIZE));
+                final int length = random.nextInt(ARRAY_MAX_LENGTH / Integer.BYTES);
                 final int[] expected = new int[length]; r.readFully(expected, 0, length);
                 final int[] actual   = new int[length]; t.readFully(actual,   0, length);
                 assertArrayEquals("readFully(int[])", expected, actual);
                 break;
             }
             case 18: {
-                final int length = random.nextInt(ARRAY_MAX_LENGTH / (Long.SIZE / Byte.SIZE));
+                final int length = random.nextInt(ARRAY_MAX_LENGTH / Long.BYTES);
                 final long[] expected = new long[length]; r.readFully(expected, 0, length);
                 final long[] actual   = new long[length]; t.readFully(actual,   0, length);
                 assertArrayEquals("readFully(long[])", expected, actual);
                 break;
             }
             case 19: {
-                final int length = random.nextInt(ARRAY_MAX_LENGTH / (Float.SIZE / Byte.SIZE));
+                final int length = random.nextInt(ARRAY_MAX_LENGTH / Float.BYTES);
                 final float[] expected = new float[length]; r.readFully(expected, 0, length);
                 final float[] actual   = new float[length]; t.readFully(actual,   0, length);
                 assertTrue("readFully(float[])", Arrays.equals(expected, actual));
                 break;
             }
             case 20: {
-                final int length = random.nextInt(ARRAY_MAX_LENGTH / (Double.SIZE / Byte.SIZE));
+                final int length = random.nextInt(ARRAY_MAX_LENGTH / Double.BYTES);
                 final double[] expected = new double[length]; r.readFully(expected, 0, length);
                 final double[] actual   = new double[length]; t.readFully(actual,   0, length);
                 assertTrue("readFully(double[])", Arrays.equals(expected, actual));

Modified: sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/io/ChannelImageOutputStreamTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/io/ChannelImageOutputStreamTest.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/io/ChannelImageOutputStreamTest.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/io/ChannelImageOutputStreamTest.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -58,7 +58,7 @@ public final strictfp class ChannelImage
      */
     @Test
     public void testWriteBits() throws IOException {
-        initialize("testWriteBits", STREAM_LENGTH, random.nextInt(BUFFER_MAX_CAPACITY) + (Long.SIZE / Byte.SIZE));
+        initialize("testWriteBits", STREAM_LENGTH, random.nextInt(BUFFER_MAX_CAPACITY) + Long.BYTES);
         final ImageOutputStream referenceStream = (ImageOutputStream) this.referenceStream;
         final int length = testedStreamBackingArray.length - ARRAY_MAX_LENGTH; // Keep a margin against buffer underflow.
         while (testedStream.getStreamPosition() < length) {
@@ -95,7 +95,7 @@ public final strictfp class ChannelImage
          */
         int nbMarks = 0;
         for (int i=0; i<STREAM_LENGTH; i++) {
-            if (randomEvent() && i < STREAM_LENGTH - (Long.SIZE / Byte.SIZE)) {
+            if (randomEvent() && i < STREAM_LENGTH - Long.BYTES) {
                 referenceStream.mark();
                 testedStream.mark();
                 nbMarks++;
@@ -144,7 +144,7 @@ public final strictfp class ChannelImage
     @DependsOnMethod("testMarkAndReset")
     public void testFlushBefore() throws IOException {
         final int N = 50; // Number of long values to write.
-        initialize("testFlushBefore", N*(Long.SIZE / Byte.SIZE), 200);
+        initialize("testFlushBefore", N*Long.BYTES, 200);
         final ImageOutputStream referenceStream = (ImageOutputStream) this.referenceStream;
         for (int i=0; i<N; i++) {
             switch (i) {
@@ -157,13 +157,13 @@ public final strictfp class ChannelImage
                     break;
                 }
                 case 10: {
-                    referenceStream.flushBefore(5 * (Long.SIZE / Byte.SIZE));
-                    testedStream.flushBefore(5 * (Long.SIZE / Byte.SIZE));
+                    referenceStream.flushBefore(5 * Long.BYTES);
+                    testedStream.flushBefore(5 * Long.BYTES);
                     break;
                 }
                 case 35: {
-                    referenceStream.flushBefore(32 * (Long.SIZE / Byte.SIZE));
-                    testedStream.flushBefore(32 * (Long.SIZE / Byte.SIZE));
+                    referenceStream.flushBefore(32 * Long.BYTES);
+                    testedStream.flushBefore(32 * Long.BYTES);
                     break;
                 }
             }

Modified: sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/io/HyperRectangleReaderTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/io/HyperRectangleReaderTest.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/io/HyperRectangleReaderTest.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/io/HyperRectangleReaderTest.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -112,7 +112,7 @@ public final strictfp class HyperRectang
          * different than zero.
          */
         final int origin = random.nextInt(10);
-        final byte[] array = new byte[origin + length*(Short.SIZE / Byte.SIZE)];
+        final byte[] array = new byte[origin + length*Short.BYTES];
         for (int i=0; i<origin; i++) {
             array[i] = (byte) random.nextInt(0x100);
         }
@@ -120,7 +120,7 @@ public final strictfp class HyperRectang
          * Fill the array with short values using the encoding describes in javadoc.
          * Then wrap the array in a pseudo-channel so we can create the reader to test.
          */
-        final ShortBuffer view = ByteBuffer.wrap(array, origin, length*(Short.SIZE / Byte.SIZE)).order(ByteOrder.nativeOrder()).asShortBuffer();
+        final ShortBuffer view = ByteBuffer.wrap(array, origin, length*Short.BYTES).order(ByteOrder.nativeOrder()).asShortBuffer();
         for (int i3=0; i3<size[3]; i3++) {
             for (int i2=0; i2<size[2]; i2++) {
                 for (int i1=0; i1<size[1]; i1++) {

Modified: sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Copyright.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Copyright.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Copyright.java [UTF-8] (original)
+++ sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Copyright.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -87,7 +87,7 @@ public final class Copyright implements
 
     /**
      * Link to an external file containing the license text, or {@code null} if none.
-     * This field is mapped to the {@code getOnlineResources() online resources} in ISO 19115 metadata.
+     * This field is mapped to the online resources in ISO 19115 metadata.
      */
     @XmlElement(name = Tags.LICENSE)
     public URI license;
@@ -431,8 +431,7 @@ resp:   for (final DefaultResponsibility
      * or an empty set if the given condition is {@code false}.
      */
     private Collection<Copyright> thisOrEmpty(final boolean condition) {
-        return condition ? Collections.<Copyright>singleton(this)
-                         : Collections.<Copyright>emptySet();
+        return condition ? Collections.singleton(this) : Collections.emptySet();
     }
 
     /**

Modified: sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/GroupAsPolylineOperation.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/GroupAsPolylineOperation.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/GroupAsPolylineOperation.java [UTF-8] (original)
+++ sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/GroupAsPolylineOperation.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -189,10 +189,6 @@ final class GroupAsPolylineOperation ext
                     @Override public Object next() {
                         return ((AbstractFeature) it.next()).getPropertyValue("sis:geometry");
                     }
-
-                    @Override public void remove() {
-                        throw new UnsupportedOperationException();
-                    }
                 });
                 geometry = getType().getValueClass().cast(geom);
             }

Modified: sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Metadata.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Metadata.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Metadata.java [UTF-8] (original)
+++ sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Metadata.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -52,7 +52,6 @@ import org.apache.sis.util.iso.SimpleInt
 import org.apache.sis.util.iso.Types;
 
 // Branch-dependent imports
-import org.apache.sis.internal.jdk8.Instant;
 import org.apache.sis.metadata.iso.citation.DefaultCitation;
 import org.apache.sis.metadata.iso.identification.AbstractIdentification;
 import org.opengis.metadata.citation.ResponsibleParty;
@@ -310,7 +309,7 @@ public final class Metadata extends Simp
     @Override
     public Collection<Keywords> getDescriptiveKeywords() {
         if (keywords != null) {
-            return Collections.<Keywords>singleton(new DefaultKeywords(keywords.toArray(new String[keywords.size()])));
+            return Collections.singleton(new DefaultKeywords(keywords.toArray(new String[keywords.size()])));
         }
         return super.getDescriptiveKeywords();
     }
@@ -326,9 +325,9 @@ public final class Metadata extends Simp
         if (creator != null) {
             final Person p = new Person(creator);
             return (author != null) ? UnmodifiableArrayList.wrap(new ResponsibleParty[] {p, author})
-                                    : Collections.<ResponsibleParty>singletonList(author);
+                                    : Collections.singletonList(author);
         }
-        return (author != null) ? Collections.<ResponsibleParty>singletonList(author) : super.getPointOfContacts();
+        return (author != null) ? Collections.singletonList(author) : super.getPointOfContacts();
     }
 
     /**
@@ -339,7 +338,7 @@ public final class Metadata extends Simp
      */
     @Override
     public Collection<Constraints> getResourceConstraints() {
-        return (copyright != null) ? Collections.<Constraints>singleton(copyright) : super.getResourceConstraints();
+        return (copyright != null) ? Collections.singleton(copyright) : super.getResourceConstraints();
     }
 
     /**
@@ -350,7 +349,7 @@ public final class Metadata extends Simp
      */
     @Override
     public Collection<Extent> getExtents() {
-        return (bounds != null) ? Collections.<Extent>singleton(bounds) : super.getExtents();
+        return (bounds != null) ? Collections.singleton(bounds) : super.getExtents();
     }
 
     /**
@@ -361,7 +360,7 @@ public final class Metadata extends Simp
      */
     @Override
     public Collection<ReferenceSystem> getReferenceSystemInfo() {
-        return Collections.<ReferenceSystem>singletonList(CommonCRS.WGS84.geographic());
+        return Collections.singletonList(CommonCRS.WGS84.geographic());
     }
 
     /**
@@ -373,7 +372,7 @@ public final class Metadata extends Simp
     @Override
     public Collection<CitationDate> getDates() {
         if (time != null) {
-            return Collections.<CitationDate>singleton(new DefaultCitationDate(time, DateType.CREATION));
+            return Collections.singleton(new DefaultCitationDate(time, DateType.CREATION));
         }
         return super.getDates();
     }
@@ -466,7 +465,7 @@ public final class Metadata extends Simp
         append(table, "Author",      author);
         append(table, "Copyright",   copyright);
         append(table, "Link(s)",     links, System.lineSeparator());
-        append(table, "Time",        Instant.create(time));
+        append(table, "Time",        (time != null) ? time.toInstant() : null);
         append(table, "Keywords",    keywords, " ");
         append(table, "Bounds",      bounds);
         table.appendHorizontalSeparator();

Modified: sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Person.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Person.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Person.java [UTF-8] (original)
+++ sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Person.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -306,8 +306,7 @@ public final class Person implements Res
      */
     @Override
     public Collection<String> getElectronicMailAddresses() {
-        return (email != null) ? Collections.<String>singleton(email)
-                               : Collections.<String>emptySet();
+        return (email != null) ? Collections.singleton(email) : Collections.emptySet();
     }
 
     /**

Modified: sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Reader.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Reader.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Reader.java [UTF-8] (original)
+++ sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Reader.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -34,9 +34,8 @@ import org.apache.sis.util.resources.Err
 import org.apache.sis.util.Version;
 
 // Branch-dependent imports
-import org.apache.sis.internal.jdk8.Consumer;
-import org.apache.sis.internal.jdk8.Predicate;
-import java.text.ParseException;
+import java.util.function.Consumer;
+import java.time.format.DateTimeParseException;
 import org.apache.sis.feature.AbstractFeature;
 
 
@@ -142,21 +141,17 @@ final class Reader extends StaxStreamRea
      * @throws JAXBException if an error occurred while parsing GPX 1.1 metadata.
      * @throws ClassCastException if an object unmarshalled by JAXB was not of the expected type.
      * @throws URISyntaxException if an error occurred while parsing URI in GPX 1.0 metadata.
-     * @throws ParseException if a text can not be parsed as a date.
+     * @throws DateTimeParseException if a text can not be parsed as a date.
      * @throws EOFException if the file seems to be truncated.
      */
     public Version initialize(final boolean readMetadata) throws DataStoreException,
-            XMLStreamException, JAXBException, URISyntaxException, ParseException, EOFException
+            XMLStreamException, JAXBException, URISyntaxException, EOFException
     {
         /*
          * Skip comments, characters, entity declarations, etc. until we find the root element.
          * If that root is anything other than <gpx>, we consider that this is not a GPX file.
          */
-        moveToRootElement(new Predicate<String>() {
-            @Override public boolean test(String value) {
-                return isGPX(value);
-            }
-        }, Tags.GPX);
+        moveToRootElement(Reader::isGPX, Tags.GPX);
         /*
          * If a version attribute is found on the <gpx> element, use that value for detecting the GPX version.
          * If a version is specified, we require major.minor version 1.0 or 1.1 but accept any bug-fix versions
@@ -360,7 +355,7 @@ parse:  while (reader.hasNext()) {
      * @throws JAXBException if an error occurred while parsing GPX 1.1 link.
      * @throws ClassCastException if an object unmarshalled by JAXB was not of the expected type.
      * @throws NumberFormatException if a text can not be parsed as an integer or a floating point number.
-     * @throws ParseException if a text can not be parsed as a date.
+     * @throws DateTimeParseException if a text can not be parsed as a date.
      * @throws EOFException if the file seems to be truncated.
      */
     @SuppressWarnings("fallthrough")

Modified: sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Store.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Store.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Store.java [UTF-8] (original)
+++ sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Store.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -42,9 +42,9 @@ import org.apache.sis.metadata.iso.citat
 import org.apache.sis.metadata.iso.distribution.DefaultFormat;
 
 // Branch-dependent imports
-import org.apache.sis.internal.jdk8.Stream;
-import org.apache.sis.internal.jdk8.StreamSupport;
-import org.apache.sis.internal.jdk8.UncheckedIOException;
+import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
+import java.io.UncheckedIOException;
 import org.apache.sis.feature.AbstractFeature;
 import org.apache.sis.feature.DefaultFeatureType;
 
@@ -213,6 +213,7 @@ public final class Store extends StaxDat
      * @return a stream over all features in the XML file.
      * @throws DataStoreException if an error occurred while creating the feature stream.
      */
+    @Override
     public final synchronized Stream<AbstractFeature> features(boolean parallel) throws DataStoreException {
         Reader r = reader;
         reader = null;

Modified: sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Types.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Types.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Types.java [UTF-8] (original)
+++ sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Types.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -47,7 +47,7 @@ import org.apache.sis.util.iso.ResourceI
 import org.apache.sis.util.iso.DefaultNameFactory;
 
 // Branch-dependent imports
-import org.apache.sis.internal.jdk8.Temporal;
+import java.time.temporal.Temporal;
 import org.apache.sis.feature.DefaultFeatureType;
 import org.apache.sis.feature.DefaultAttributeType;
 
@@ -309,15 +309,10 @@ final class Types {
         for (final PropertyTypeBuilder p : builder.properties()) {
             final GenericName name = p.getName();
             if (!AttributeConvention.contains(name)) {
-                final String key = name.toString();
-                InternationalString[] resources = previous.get(key);
-                if (resources == null) {
-                    resources = new InternationalString[] {
-                        new ResourceInternationalString("org.apache.sis.internal.storage.gpx.Designations", key),
-                        new ResourceInternationalString("org.apache.sis.internal.storage.gpx.Definitions",  key)
-                    };
-                    previous.put(key, resources);
-                }
+                final InternationalString[] resources = previous.computeIfAbsent(name.toString(), (key) -> new InternationalString[] {
+                    new ResourceInternationalString("org.apache.sis.internal.storage.gpx.Designations", key),
+                    new ResourceInternationalString("org.apache.sis.internal.storage.gpx.Definitions",  key)
+                });
                 p.setDefinition (resources[1]);
                 p.setDesignation(resources[0]);
             }



Mime
View raw message