sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1822268 [5/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/core/sis-utility/src/test/java/org/apache/sis/util/collection/IntegerListTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/collection/IntegerListTest.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/collection/IntegerListTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/collection/IntegerListTest.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -23,6 +23,7 @@ import java.util.HashSet;
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.Random;
+import java.util.ConcurrentModificationException;
 import org.apache.sis.test.TestCase;
 import org.apache.sis.test.TestUtilities;
 import org.junit.Test;
@@ -30,6 +31,11 @@ import org.junit.Test;
 import static java.lang.StrictMath.*;
 import static org.apache.sis.test.Assert.*;
 
+// Branch-dependent imports
+import java.util.function.IntConsumer;
+import java.util.PrimitiveIterator;
+import java.util.stream.IntStream;
+
 
 /**
  * Tests {@link IntegerList} implementations.
@@ -89,6 +95,12 @@ public final strictfp class IntegerListT
         assertEquals("Comparison with reference implementation", copy, list);
         assertEquals("hashCode()", copy.hashCode(), list.hashCode());
         /*
+         * Test the stream, using the ArrayList as a reference implementation. This will indirectly
+         * use the PrimitiveSpliterator.forEachRemaining(Consumer<? super Integer>) method. A more
+         * specific test using forEachRemaining(IntConsumer) is done by the testInts() method.
+         */
+        assertSequentialStreamEquals(copy.iterator(), list.stream());
+        /*
          * Tests cloning and removal of values in a range of indices. The IntegerList.removeRange(…)
          * method is invoked indirectly by subList(…).clear(). Again, we use ArrayList as a reference.
          */
@@ -100,13 +112,13 @@ public final strictfp class IntegerListT
         clone.subList(128, 256).clear();
         assertEquals("After removeRange(…)", copy, clone);
         /*
-         * Tests iterator on integers, with random removal of some elements during traversal.
+         * Tests iterator on primitive integers, with random removal of some elements during traversal.
          */
-        final Iterator<Integer> it = clone.iterator();
+        final PrimitiveIterator.OfInt it = clone.iterator();
         final Iterator<Integer> itRef = copy.iterator();
         while (itRef.hasNext()) {
             assertTrue("hasNext()", it.hasNext());
-            assertEquals(itRef.next(), it.next());
+            assertEquals(itRef.next().intValue(), it.nextInt());
             if (random.nextInt(10) == 0) {
                 itRef.remove();
                 it.remove();
@@ -219,4 +231,68 @@ public final strictfp class IntegerListT
         testReadWrite(Integer.MAX_VALUE);
         testFill(17);
     }
+
+    /**
+     * Tests that primitive stream traversal is coherent with its list value.
+     * This method tests sequential stream only.
+     */
+    @Test
+    public void testStream() {
+        list = createRandomlyFilled(42, 404);
+        list.stream(false).forEach(new IntConsumer() {
+            private int index = 0;
+
+            @Override
+            public void accept(int value) {
+                assertEquals("Spliterator value differs from its original list", list.getInt(index++), value);
+            }
+        });
+    }
+
+    /**
+     * Tests that primitive stream traversal with parallelization.
+     */
+    @Test
+    public void testIntsParallel() {
+        list = createRandomlyFilled(80, 321);
+        assertParallelStreamEquals(list.iterator(), list.stream().parallel());
+    }
+
+    /**
+     * Ensures our stream is a fail-fast operator, i.e: it fails when the list has
+     * been modified before the end of its iteration.
+     */
+    @Test
+    public void testErrorOnCoModification() {
+        list = createRandomlyFilled(4, 10);
+        final PrimitiveIterator.OfInt values = list.stream(false).iterator();
+
+        // Start iteration normally.
+        assertEquals(list.getInt(0), values.nextInt());
+        assertEquals(list.getInt(1), values.nextInt());
+
+        // Now, if we alter the list and then try to use previously created stream, we should get an error.
+        list.add(0);
+        try {
+            values.next();
+            fail("Concurrent modification has not been detected.");
+        } catch (ConcurrentModificationException expected) {
+            // Expected behavior
+        }
+    }
+
+    /**
+     * Creates a new list whose capacity and value magnitude are defined as input.
+     * The list is filled by a random integer generator before return.
+     *
+     * @param  size      number of elements to insert in the list.
+     * @param  maxValue  maximum value to use for value insertion.
+     * @return a fresh and filled list.
+     */
+    private static IntegerList createRandomlyFilled(final int size, final int maxValue) {
+        final Random random = TestUtilities.createRandomNumberGenerator();
+        return IntStream.generate(() -> random.nextInt(maxValue))
+                .limit(size)
+                .collect(() -> new IntegerList(size, maxValue), IntegerList::addInt, null);
+    }
 }

Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/collection/WeakHashSetTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/collection/WeakHashSetTest.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/collection/WeakHashSetTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/collection/WeakHashSetTest.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -18,7 +18,6 @@ package org.apache.sis.util.collection;
 
 import java.util.HashSet;
 import java.util.Random;
-import java.util.concurrent.Callable;
 import org.apache.sis.test.TestCase;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.DependsOnMethod;
@@ -156,21 +155,13 @@ public final strictfp class WeakHashSetT
              * happen too often, we may turn off the "allow garbage collector dependent tests" flag.
              */
             if (TestConfiguration.allowGarbageCollectorDependentTests()) {
-                waitForGarbageCollection(new Callable<Boolean>() {
-                    @Override public Boolean call() {
-                        return weakSet.size() == strongSet.size();
-                    }
-                });
+                waitForGarbageCollection(() -> weakSet.size() == strongSet.size());
                 assertSetEquals(strongSet, weakSet);
                 /*
                  * Clearing all strong references should make the set empty.
                  */
                 strongSet.clear();
-                assertTrue("Expected an empty set.", waitForGarbageCollection(new Callable<Boolean>() {
-                    @Override public Boolean call() {
-                        return weakSet.isEmpty();
-                    }
-                }));
+                assertTrue("Expected an empty set.", waitForGarbageCollection(weakSet::isEmpty));
             }
         }
     }

Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/collection/WeakValueHashMapTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/collection/WeakValueHashMapTest.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/collection/WeakValueHashMapTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/collection/WeakValueHashMapTest.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -19,7 +19,6 @@ package org.apache.sis.util.collection;
 import java.util.Map;
 import java.util.HashMap;
 import java.util.Random;
-import java.util.concurrent.Callable;
 import org.apache.sis.test.TestCase;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.DependsOnMethod;
@@ -58,7 +57,7 @@ public final strictfp class WeakValueHas
      */
     @Test
     public void testStrongReferences() {
-        testStrongReferences(new WeakValueHashMap<Integer,Integer>(Integer.class));
+        testStrongReferences(new WeakValueHashMap<>(Integer.class));
     }
 
     /**
@@ -100,7 +99,7 @@ public final strictfp class WeakValueHas
     @Test
     @DependsOnMethod("testStrongReferences")
     public void testWeakReferences() throws InterruptedException {
-        testWeakReferences(new WeakValueHashMap<Integer,Integer>(Integer.class));
+        testWeakReferences(new WeakValueHashMap<>(Integer.class));
     }
 
     /**
@@ -164,21 +163,13 @@ public final strictfp class WeakValueHas
              * happen too often, we may turn off the "allow garbage collector dependent tests" flag.
              */
             if (TestConfiguration.allowGarbageCollectorDependentTests()) {
-                waitForGarbageCollection(new Callable<Boolean>() {
-                    @Override public Boolean call() {
-                        return weakMap.size() == strongMap.size();
-                    }
-                });
+                waitForGarbageCollection(() -> weakMap.size() == strongMap.size());
                 assertMapEquals(strongMap, weakMap);
                 /*
                  * Clearing all strong references should make the map empty.
                  */
                 strongMap.clear();
-                assertTrue("Expected an empty map.", waitForGarbageCollection(new Callable<Boolean>() {
-                    @Override public Boolean call() {
-                        return weakMap.isEmpty();
-                    }
-                }));
+                assertTrue("Expected an empty map.", waitForGarbageCollection(weakMap::isEmpty));
             }
         }
     }

Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/iso/TypesTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/iso/TypesTest.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/iso/TypesTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/iso/TypesTest.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -51,8 +51,8 @@ public final strictfp class TypesTest ex
      */
     @Test
     public void testToInternationalString() {
-        testToInternationalString(new HashMap<String,Object>());
-        testToInternationalString(new TreeMap<String,Object>());
+        testToInternationalString(new HashMap<>());
+        testToInternationalString(new TreeMap<>());
     }
 
     /**

Modified: sis/trunk/ide-project/NetBeans/nbproject/project.properties
URL: http://svn.apache.org/viewvc/sis/trunk/ide-project/NetBeans/nbproject/project.properties?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/ide-project/NetBeans/nbproject/project.properties [ISO-8859-1] (original)
+++ sis/trunk/ide-project/NetBeans/nbproject/project.properties [ISO-8859-1] Fri Jan 26 10:48:27 2018
@@ -35,8 +35,8 @@ project.license      = apache20
 project.licensePath  = ../../ide-project/LicenseHeader.txt
 no.dependencies      = true
 source.encoding      = UTF-8
-javac.source         = 1.7
-javac.target         = 1.7
+javac.source         = 1.8
+javac.target         = 1.8
 platform.active      = default_platform
 junit.forkmode       = once
 run.jvmargs          = -ea -Dorg.apache.sis.test.verbose=true -Dorg.apache.sis.test.extensive=true
@@ -105,8 +105,8 @@ slf4j.version        = 1.7.22
 junit.version        = 4.12
 hamcrest.version     = 1.3
 jaxb-ns-mapper       = 2.2.4
-hsqldb.version       = 2.3.5
-postgresql.version   = 42.1.4.jre7
+hsqldb.version       = 2.4.0
+postgresql.version   = 42.1.4
 icons.version        = 3.0.1
 
 #

Modified: sis/trunk/pom.xml
URL: http://svn.apache.org/viewvc/sis/trunk/pom.xml?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/pom.xml (original)
+++ sis/trunk/pom.xml Fri Jan 26 10:48:27 2018
@@ -433,18 +433,18 @@ Apache SIS is a free software, Java lang
       <dependency>
         <groupId>org.apache.derby</groupId>
         <artifactId>derby</artifactId>
-        <version>10.12.1.1</version>            <!-- Last version compatible with JDK7.-->
+        <version>10.13.1.1</version>
       </dependency>
       <dependency>
         <groupId>org.hsqldb</groupId>
         <artifactId>hsqldb</artifactId>
-        <version>2.3.5</version>                <!-- Last version compatible with JDK7.-->
+        <version>2.4.0</version>
         <scope>test</scope>
       </dependency>
       <dependency>
         <groupId>org.postgresql</groupId>
         <artifactId>postgresql</artifactId>
-        <version>42.1.4.jre7</version>
+        <version>42.1.4</version>
         <scope>test</scope>
       </dependency>
 
@@ -496,8 +496,8 @@ Apache SIS is a free software, Java lang
     <website.locale>en</website.locale>
 
     <!-- Following properties are branch-specific -->
-    <maven.compile.source>1.7</maven.compile.source>
-    <maven.compile.target>1.7</maven.compile.target>
+    <maven.compile.source>1.8</maven.compile.source>
+    <maven.compile.target>1.8</maven.compile.target>
     <sis.plugin.version>${project.version}</sis.plugin.version>
     <sis.non-free.version>0.8</sis.non-free.version>
     <geoapi.version>3.0.1</geoapi.version>
@@ -515,24 +515,7 @@ Apache SIS is a free software, Java lang
 
     <!-- Cross-version compilation (to be removed with JDK9). -->
     <profile>
-      <id>jdk8</id>
-      <activation>
-        <jdk>1.8</jdk>
-      </activation>
-      <build>
-        <plugins>
-          <plugin>
-            <artifactId>maven-javadoc-plugin</artifactId>
-            <configuration>
-              <additionalparam>
-                -Xdoclint:syntax -Xdoclint:html -Xdoclint:missing -Xdoclint:accessibility
-              </additionalparam>
-            </configuration>
-          </plugin>
-        </plugins>
-      </build>
-    </profile>
-    <profile>
+      <id>bootclasspath</id>
       <activation>
         <property>
           <name>bootclasspath</name>
@@ -605,6 +588,8 @@ Apache SIS is a free software, Java lang
           <useIncrementalCompilation>false</useIncrementalCompilation> <!-- https://jira.codehaus.org/browse/MCOMPILER-209 -->
           <compilerArgs>
             <arg>-Xlint:all</arg>
+            <arg>-Xdoclint:syntax,html,missing/protected,accessibility/protected</arg>
+            <arg>-h</arg> <arg>${project.build.sourceDirectory}/../c</arg>
           </compilerArgs>
         </configuration>
       </plugin>
@@ -698,6 +683,13 @@ Apache SIS is a free software, Java lang
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-checkstyle-plugin</artifactId>
         <version>2.17</version>
+        <dependencies>
+          <dependency>
+            <groupId>com.puppycrawl.tools</groupId>
+            <artifactId>checkstyle</artifactId>
+            <version>8.2</version>
+          </dependency>
+        </dependencies>
         <executions>
           <execution>
             <goals>
@@ -728,20 +720,20 @@ Apache SIS is a free software, Java lang
                       <property name="tokens" value="COMMA"/>
                     </module>
                     <module name="WhitespaceAfter">                 <!-- Checks that a token is followed by whitespace. -->
-                      <property name="tokens" value="TYPECAST"/>
+                      <property name="tokens" value="TYPECAST, LITERAL_IF, LITERAL_ELSE, LITERAL_WHILE, LITERAL_DO, LITERAL_FOR, DO_WHILE"/>
                     </module>
                     <module name="NoWhitespaceAfter">               <!-- No whitespace after "++" in ++x, etc. -->
                       <property name="tokens" value="INC, DEC, BNOT, LNOT"/>
                     </module>
                     <module name="NoWhitespaceBefore">              <!-- No whitespace before "++" in x++, etc. -->
-                      <property name="tokens" value="COMMA, POST_INC, POST_DEC"/>
+                      <property name="tokens" value="COMMA, POST_INC, POST_DEC, ELLIPSIS"/>
                     </module>
                     <module name="WhitespaceAround">
                       <property name="tokens" value="
                         MINUS_ASSIGN, STAR_ASSIGN, DIV_ASSIGN, MOD_ASSIGN, MOD,
                         SL, SL_ASSIGN, SR, SR_ASSIGN, BSR, BSR_ASSIGN,
                         BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BXOR, BXOR_ASSIGN,
-                        TYPE_EXTENSION_AND, LAND, LOR, QUESTION,
+                        TYPE_EXTENSION_AND, LAND, LOR, QUESTION, LAMBDA,
                         COLON, DO_WHILE, LITERAL_DO, LITERAL_WHILE, LITERAL_FOR,
                         LITERAL_ELSE, LITERAL_SWITCH,
                         LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY,
@@ -750,6 +742,8 @@ Apache SIS is a free software, Java lang
                       <property name="allowEmptyMethods"      value="true"/>
                       <property name="allowEmptyTypes"        value="true"/>
                       <property name="allowEmptyLoops"        value="true"/>
+                      <property name="allowEmptyLambdas"      value="true"/>
+                      <property name="allowEmptyCatches"      value="true"/>
                     </module>
                     <!--
                       Code formatting on other aspects than whitespaces. When there is different ways to express
@@ -771,6 +765,7 @@ Apache SIS is a free software, Java lang
                     <module name="OuterTypeNumber"/>                <!-- Only one outer type per file. -->
                     <module name="OuterTypeFilename"/>              <!-- Outer type name and file name shall match. -->
                     <module name="InterfaceIsType"/>                <!-- Do not allow interface without methods. -->
+                    <module name="FinalClass"/>                     <!-- Class having only private constructors should be final. -->
                     <module name="PackageDeclaration"/>             <!-- All classes shall be in a package. -->
                     <module name="HideUtilityClassConstructor"/>    <!-- No public constructor in utility classes. -->
                     <module name="MissingOverride"/>                <!-- @Override annotation everywhere applicable. -->
@@ -780,7 +775,7 @@ Apache SIS is a free software, Java lang
                     <module name="ExplicitInitialization"/>         <!-- No unnecessary initialization to 0 or null. -->
                     <module name="SimplifyBooleanReturn"/>          <!-- No if (boolean) return true; else return false. -->
                     <module name="RedundantModifier">               <!-- No modifiers that were implicit. -->
-                      <property name="tokens" value="VARIABLE_DEF, ANNOTATION_FIELD_DEF, INTERFACE_DEF, CLASS_DEF, ENUM_DEF"/>
+                      <property name="tokens" value="VARIABLE_DEF, ANNOTATION_FIELD_DEF, INTERFACE_DEF, CLASS_DEF, ENUM_DEF, RESOURCE"/>
                     </module>
                   </module>
                   <module name="UniqueProperties"/>                 <!-- No duplicated keys in *.properties files. -->
@@ -814,6 +809,10 @@ Apache SIS is a free software, Java lang
             <link>http://www.unidata.ucar.edu/software/thredds/current/netcdf-java/javadoc</link>
           </links>
 
+          <additionalparam>
+            -Xdoclint:syntax -Xdoclint:html -Xdoclint:missing -Xdoclint:accessibility
+          </additionalparam>
+
           <!-- Separates packages on the overview page into the groups specified. -->
           <groups>
             <group>
@@ -922,7 +921,7 @@ Apache SIS is a free software, Java lang
         <plugin>
           <groupId>org.eclipse.jetty</groupId>
           <artifactId>jetty-maven-plugin</artifactId>
-          <version>9.2.13.v20150730</version>           <!-- Versions 9.3.* require JDK 8 -->
+          <version>9.4.7.v20170914</version>
         </plugin>
       </plugins>
     </pluginManagement>

Modified: sis/trunk/profiles/sis-french-profile/src/test/java/org/apache/sis/internal/profile/fra/DirectReferenceSystemTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/profiles/sis-french-profile/src/test/java/org/apache/sis/internal/profile/fra/DirectReferenceSystemTest.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/profiles/sis-french-profile/src/test/java/org/apache/sis/internal/profile/fra/DirectReferenceSystemTest.java [UTF-8] (original)
+++ sis/trunk/profiles/sis-french-profile/src/test/java/org/apache/sis/internal/profile/fra/DirectReferenceSystemTest.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -17,7 +17,6 @@
 package org.apache.sis.internal.profile.fra;
 
 import java.util.Collection;
-import java.util.Collections;
 import javax.xml.bind.JAXBException;
 import org.opengis.metadata.citation.ResponsibleParty;
 import org.apache.sis.metadata.iso.DefaultMetadata;
@@ -61,7 +60,7 @@ public final strictfp class DirectRefere
         final DefaultCitation citation = new DefaultCitation("EPSG Geodetic Parameter Dataset");
         Collection<ResponsibleParty> r = HardCodedCitations.EPSG.getCitedResponsibleParties();
         if (legacy) {
-            r = Collections.<ResponsibleParty>singleton(new DefaultResponsibleParty(TestUtilities.getSingleton(r)));
+            r = singleton(new DefaultResponsibleParty(TestUtilities.getSingleton(r)));
         }
         citation.setCitedResponsibleParties(r);
         final DirectReferenceSystem refSys = new DirectReferenceSystem(new ImmutableIdentifier(citation, null, "4326"));

Modified: sis/trunk/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java [UTF-8] (original)
+++ sis/trunk/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -69,11 +69,11 @@ import org.apache.sis.internal.util.Util
 import static org.apache.sis.internal.util.CollectionsExt.singletonOrNull;
 
 // Branch-dependent imports
-import org.apache.sis.internal.jdk8.LocalDate;
-import org.apache.sis.internal.jdk8.OffsetDateTime;
-import org.apache.sis.internal.jdk8.OffsetTime;
-import org.apache.sis.internal.jdk8.Temporal;
-import org.apache.sis.internal.jdk8.DateTimeException;
+import java.time.LocalDate;
+import java.time.OffsetDateTime;
+import java.time.OffsetTime;
+import java.time.DateTimeException;
+import java.time.temporal.Temporal;
 
 
 /**
@@ -139,7 +139,7 @@ final class LandsatReader {
      * The pattern determining if the value of {@code ORIGIN} key is of the form
      * “Image courtesy of the U.S. Geological Survey”.
      */
-    static final Pattern CREDIT = Pattern.compile("\\bcourtesy\\s+of\\s+(the)?\\b\\s*", Pattern.CASE_INSENSITIVE);
+    static final Pattern CREDIT = Pattern.compile("\\bcourtesy\\h+of\\h+(the)?\\b\\s*", Pattern.CASE_INSENSITIVE);
 
     /**
      * Number of spatial dimensions. This is the number of ordinate values to be stored

Modified: sis/trunk/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatReaderTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatReaderTest.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatReaderTest.java [UTF-8] (original)
+++ sis/trunk/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatReaderTest.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -24,7 +24,6 @@ import java.io.InputStreamReader;
 import org.opengis.metadata.Metadata;
 import org.opengis.util.FactoryException;
 import org.apache.sis.metadata.iso.DefaultMetadata;
-import org.apache.sis.storage.DataStore;
 import org.apache.sis.storage.DataStoreException;
 import org.apache.sis.util.logging.EmptyWarningListeners;
 import org.apache.sis.internal.system.Modules;
@@ -88,7 +87,7 @@ public class LandsatReaderTest extends T
                 LandsatReaderTest.class.getResourceAsStream("LandsatTest.txt"), "UTF-8")))
         {
             final LandsatReader reader = new LandsatReader("LandsatTest.txt",
-                    new EmptyWarningListeners<DataStore>(Locale.ENGLISH, Modules.EARTH_OBSERVATION));
+                    new EmptyWarningListeners<>(Locale.ENGLISH, Modules.EARTH_OBSERVATION));
             reader.read(in);
             actual = reader.getMetadata();
         }

Modified: sis/trunk/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4Factory.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4Factory.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4Factory.java [UTF-8] (original)
+++ sis/trunk/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4Factory.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -62,9 +62,6 @@ import org.apache.sis.util.CharSequences
 import org.apache.sis.util.Classes;
 import org.apache.sis.measure.Units;
 
-// Branch-dependent imports
-import org.apache.sis.internal.jdk8.Predicate;
-
 
 /**
  * A factory for Coordinate Reference Systems created from {@literal Proj.4} definitions.
@@ -202,7 +199,7 @@ public class Proj4Factory extends Geodet
      * @param properties  common properties for the objects to create, or {@code null} if none.
      */
     public Proj4Factory(Map<String,?> properties) {
-        properties   = new HashMap(properties != null ? properties : Collections.emptyMap());
+        properties   = new HashMap<>(properties != null ? properties : Collections.emptyMap());
         crsFactory   = factory(CRSFactory.class,           properties, ReferencingServices.CRS_FACTORY);
         csFactory    = factory(CSFactory.class,            properties, ReferencingServices.CS_FACTORY);
         datumFactory = factory(DatumFactory.class,         properties, ReferencingServices.DATUM_FACTORY);
@@ -234,7 +231,7 @@ public class Proj4Factory extends Geodet
     final DefaultCoordinateOperationFactory opFactory() {
         DefaultCoordinateOperationFactory factory = opFactory;
         if (factory == null) {
-            final Map<String,Object> properties = new HashMap<String,Object>(defaultProperties);
+            final Map<String,Object> properties = new HashMap<>(defaultProperties);
             properties.put(ReferencingServices.CRS_FACTORY,   crsFactory);
             properties.put(ReferencingServices.CS_FACTORY,    csFactory);
             properties.put(ReferencingServices.DATUM_FACTORY, datumFactory);
@@ -334,11 +331,7 @@ public class Proj4Factory extends Geodet
      * @see org.apache.sis.referencing.operation.transform.DefaultMathTransformFactory#getAvailableMethods(Class)
      */
     public Set<OperationMethod> getAvailableMethods(final Class<? extends SingleOperation> type) {
-        return new LazySet<>(CollectionsExt.filter(mtFactory.getAvailableMethods(type).iterator(), new Predicate<IdentifiedObject>() {
-            @Override public boolean test(final IdentifiedObject method) {
-                return isSupported(method);
-            }
-        }));
+        return new LazySet<>(CollectionsExt.filter(mtFactory.getAvailableMethods(type).iterator(), Proj4Factory::isSupported));
     }
 
     /**
@@ -550,16 +543,14 @@ public class Proj4Factory extends Geodet
      * Returns the identifier for the given code in {@literal Proj.4} namespace.
      */
     private Map<String,Object> identifier(final String code) {
-        Identifier id = identifiers.get(code);
-        if (id == null) {
+        Identifier id = identifiers.computeIfAbsent(code, (k) -> {
             short i18n = 0;
-            if (code.equalsIgnoreCase( UNNAMED )) i18n = Vocabulary.Keys.Unnamed;
-            if (code.equalsIgnoreCase("Unknown")) i18n = Vocabulary.Keys.Unknown;
-            id = new ImmutableIdentifier(Citations.PROJ4, Constants.PROJ4, code, null,
+            if (k.equalsIgnoreCase( UNNAMED )) i18n = Vocabulary.Keys.Unnamed;
+            if (k.equalsIgnoreCase("Unknown")) i18n = Vocabulary.Keys.Unknown;
+            return new ImmutableIdentifier(Citations.PROJ4, Constants.PROJ4, k, null,
                     (i18n != 0) ? Vocabulary.formatInternational(i18n) : null);
-            identifiers.put(code, id);
-        }
-        final Map<String,Object> properties = new HashMap<String,Object>(defaultProperties);
+        });
+        final Map<String,Object> properties = new HashMap<>(defaultProperties);
         properties.put(IdentifiedObject.NAME_KEY, id);
         return properties;
     }

Modified: sis/trunk/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/CRSBuilder.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/CRSBuilder.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/CRSBuilder.java [UTF-8] (original)
+++ sis/trunk/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/CRSBuilder.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -21,6 +21,7 @@ import java.util.Map;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Collections;
+import java.util.StringJoiner;
 import java.util.logging.Level;
 import java.util.logging.LogRecord;
 import java.util.NoSuchElementException;
@@ -88,7 +89,6 @@ import org.apache.sis.util.Debug;
 import static org.apache.sis.util.Utilities.equalsIgnoreMetadata;
 
 // Branch-dependent imports
-import org.apache.sis.internal.jdk8.JDK8;
 import org.apache.sis.referencing.operation.DefaultCoordinateOperationFactory;
 
 
@@ -369,12 +369,9 @@ final class CRSBuilder {
         if (value != null) {
             if (value.getClass().isArray()) {
                 final int length = Array.getLength(value);
-                final StringBuffer buffer = new StringBuffer();
+                final StringJoiner buffer = new StringJoiner(", ");
                 for (int i=0; i<length; i++) {
-                    if (buffer.length() != 0) {
-                        buffer.append(", ");
-                    }
-                    buffer.append(Array.get(value, i));
+                    buffer.add(String.valueOf(Array.get(value, i)));
                 }
                 value = buffer;
             }
@@ -785,12 +782,9 @@ final class CRSBuilder {
          * Build a list of remaining GeoKeys.
          */
         if (!geoKeys.isEmpty()) {
-            final StringBuilder joiner = new StringBuilder();
+            final StringJoiner joiner = new StringJoiner(", ");
             for (final short key : remainingKeys()) {
-                if (joiner.length() != 0) {
-                    joiner.append(", ");
-                }
-                joiner.append(GeoKeys.name(key));
+                joiner.add(GeoKeys.name(key));
             }
             warning(Resources.Keys.IgnoredGeoKeys_1, joiner.toString());
         }
@@ -1405,11 +1399,11 @@ final class CRSBuilder {
     private static void aliases(final Map<Integer,String> mapping) {
         for (final short[] codes : PARAMETER_ALIASES) {
             for (int i=0; i<codes.length; i++) {
-                final String name = mapping.get(codes[i] & 0xFFFF);
+                final String name = mapping.get(Short.toUnsignedInt(codes[i]));
                 if (name != null) {
                     for (int j=0; j<codes.length; j++) {
                         if (j != i) {
-                            JDK8.putIfAbsent(mapping, codes[j] & 0xFFFF, name);
+                            mapping.putIfAbsent(Short.toUnsignedInt(codes[j]), name);
                         }
                     }
                     break;
@@ -1544,7 +1538,7 @@ final class CRSBuilder {
                     }
                     final Number value = (Number) entry.getValue();
                     it.remove();
-                    final String paramName = toNames.get(key & 0xFFFF);
+                    final String paramName = toNames.get(Short.toUnsignedInt(key));
                     if (paramName != null) {
                         paramValues.put(paramName, value);
                         parameters.parameter(paramName).setValue(value.doubleValue(), unit);
@@ -1563,14 +1557,14 @@ final class CRSBuilder {
                     aliases(toNames);
                     for (final Map.Entry<Short,Unit<?>> entry : deferred.entrySet()) {
                         final Short key = entry.getKey();
-                        String paramName = toNames.get(key & 0xFFFF);
+                        String paramName = toNames.get(Short.toUnsignedInt(key));
                         if (paramName == null) {
                             paramName = GeoKeys.name(key);
                             throw new ParameterNotFoundException(reader.errors().getString(
                                     Errors.Keys.UnexpectedParameter_1, paramName), paramName);
                         }
                         final Number value  = paramValues.get(key);
-                        final Number actual = JDK8.putIfAbsent(paramValues, paramName, value);
+                        final Number actual = paramValues.putIfAbsent(paramName, value);
                         if (actual == null) {
                             parameters.parameter(paramName).setValue(value.doubleValue(), entry.getValue());
                         } else if (!actual.equals(value)) {

Modified: sis/trunk/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoKeys.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoKeys.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoKeys.java [UTF-8] (original)
+++ sis/trunk/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoKeys.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -138,6 +138,6 @@ final class GeoKeys {
         } catch (IllegalAccessException e) {
             throw new AssertionError(e);        // Should never happen because we asked only for public fields.
         }
-        return Integer.toHexString(key & 0xFFFF);
+        return Integer.toHexString(Short.toUnsignedInt(key));
     }
 }

Modified: sis/trunk/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStoreProvider.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStoreProvider.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStoreProvider.java [UTF-8] (original)
+++ sis/trunk/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStoreProvider.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -106,7 +106,7 @@ public class GeoTiffStoreProvider extend
     public ProbeResult probeContent(StorageConnector connector) throws DataStoreException {
         final ByteBuffer buffer = connector.getStorageAs(ByteBuffer.class);
         if (buffer != null) {
-            if (buffer.remaining() < 2 * (Short.SIZE / Byte.SIZE)) {
+            if (buffer.remaining() < 2 * Short.BYTES) {
                 return ProbeResult.INSUFFICIENT_BYTES;
             }
             final int p = buffer.position();
@@ -116,7 +116,7 @@ public class GeoTiffStoreProvider extend
                 final ByteOrder old = buffer.order();
                 try {
                     buffer.order(isBigEndian ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN);
-                    switch (buffer.getShort(p + (Short.SIZE / Byte.SIZE))) {
+                    switch (buffer.getShort(p + Short.BYTES)) {
                         case GeoTIFF.CLASSIC:
                         case GeoTIFF.BIG_TIFF: return new ProbeResult(true, MIME_TYPE, VERSION);
                     }

Modified: sis/trunk/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/ImageFileDirectory.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/ImageFileDirectory.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/ImageFileDirectory.java [UTF-8] (original)
+++ sis/trunk/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/ImageFileDirectory.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -43,9 +43,6 @@ import org.apache.sis.storage.DataStoreC
 import org.apache.sis.math.Vector;
 import org.apache.sis.measure.Units;
 
-// Branch-dependent imports
-import org.apache.sis.internal.jdk8.JDK8;
-
 
 /**
  * An Image File Directory (FID) in a TIFF image.
@@ -712,7 +709,7 @@ final class ImageFileDirectory {
                 switch (values.length) {
                     case 0:  break;
                     case 1:  asciiGeoParameters = values[0]; break;
-                    default: asciiGeoParameters = JDK8.join("\u0000", values).concat("\u0000"); break;
+                    default: asciiGeoParameters = String.join("\u0000", values).concat("\u0000"); break;
                 }
                 break;
             }
@@ -995,7 +992,7 @@ final class ImageFileDirectory {
      * @throws ArithmeticException if the result overflows.
      */
     private long pixelToByteCount(long value) {
-        value = JDK8.multiplyExact(value, samplesPerPixel * (int) bitsPerSample);
+        value = Math.multiplyExact(value, samplesPerPixel * (int) bitsPerSample);
         return (value % Byte.SIZE == 0) ? value / Byte.SIZE : -1;
     }
 
@@ -1017,7 +1014,7 @@ final class ImageFileDirectory {
                 // At this point, we verified that all vector values are equal.
                 final long length = pixelToByteCount(knownSize);
                 if (count % length != 0) break;
-                return JDK8.toIntExact(count / length);
+                return Math.toIntExact(count / length);
             } while (tileByteCounts.longValue(i) == n);
         }
         return -1;
@@ -1043,8 +1040,8 @@ final class ImageFileDirectory {
         final short offsetsTag, byteCountsTag;
         switch (tileTagFamily) {
             case STRIP: {
-                if (tileWidth  < 0) tileWidth  = JDK8.toIntExact(imageWidth);
-                if (tileHeight < 0) tileHeight = JDK8.toIntExact(imageHeight);
+                if (tileWidth  < 0) tileWidth  = Math.toIntExact(imageWidth);
+                if (tileHeight < 0) tileHeight = Math.toIntExact(imageHeight);
                 offsetsTag    = Tags.StripOffsets;
                 byteCountsTag = Tags.StripByteCounts;
                 break;
@@ -1118,7 +1115,7 @@ final class ImageFileDirectory {
                 break;
             }
             case 0b0100: {          // Compute missing tile byte count.
-                final long tileByteCount = pixelToByteCount(JDK8.multiplyExact(tileWidth, tileHeight));
+                final long tileByteCount = pixelToByteCount(Math.multiplyExact(tileWidth, tileHeight));
                 final long[] tileByteCountArray = new long[tileOffsets.size()];
                 Arrays.fill(tileByteCountArray, tileByteCount);
                 tileByteCounts = Vector.create(tileByteCountArray, true);
@@ -1141,11 +1138,11 @@ final class ImageFileDirectory {
          * one documented in the TIFF specification and reproduced in tileWidth & tileHeight fields javadoc.
          */
         ensureSameLength(offsetsTag, byteCountsTag, tileOffsets.size(), tileByteCounts.size());
-        long expectedCount = JDK8.multiplyExact(
-                JDK8.addExact(imageWidth,  tileWidth  - 1) / tileWidth,
-                JDK8.addExact(imageHeight, tileHeight - 1) / tileHeight);
+        long expectedCount = Math.multiplyExact(
+                Math.addExact(imageWidth,  tileWidth  - 1) / tileWidth,
+                Math.addExact(imageHeight, tileHeight - 1) / tileHeight);
         if (isPlanar) {
-            expectedCount = JDK8.multiplyExact(expectedCount, samplesPerPixel);
+            expectedCount = Math.multiplyExact(expectedCount, samplesPerPixel);
         }
         final int actualCount = Math.min(tileOffsets.size(), tileByteCounts.size());
         if (actualCount != expectedCount) {

Modified: sis/trunk/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/Reader.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/Reader.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/Reader.java [UTF-8] (original)
+++ sis/trunk/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/Reader.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -32,10 +32,6 @@ import org.apache.sis.internal.storage.M
 import org.apache.sis.internal.geotiff.Resources;
 import org.apache.sis.util.resources.Errors;
 
-// Branch-dependent imports
-import java.util.Collections;
-import org.apache.sis.internal.jdk8.JDK8;
-
 
 /**
  * An image reader for GeoTIFF files. This reader duplicates the implementations performed by other libraries, but we
@@ -248,14 +244,14 @@ final class Reader extends GeoTIFF {
                 return null;
             }
             resolveDeferredEntries(null, nextIFD);
-            input.seek(JDK8.addExact(origin, nextIFD));
+            input.seek(Math.addExact(origin, nextIFD));
             nextIFD = 0;               // Prevent trying other IFD if we fail to read this one.
             /*
              * Design note: we parse the Image File Directory entry now because even if we were
              * not interrested in that IFD, we need to go anyway after its last record in order
              * to get the pointer to the next IFD.
              */
-            final int offsetSize = (Integer.SIZE / Byte.SIZE) << intSizeExpansion;
+            final int offsetSize = Integer.BYTES << intSizeExpansion;
             final ImageFileDirectory dir = new ImageFileDirectory(this);
             for (long remaining = readUnsignedShort(); --remaining >= 0;) {
                 /*
@@ -268,7 +264,7 @@ final class Reader extends GeoTIFF {
                 final short tag  = (short) input.readUnsignedShort();
                 final Type type  = Type.valueOf(input.readShort());        // May be null.
                 final long count = readUnsignedInt();
-                final long size  = (type != null) ? JDK8.multiplyExact(type.size, count) : 0;
+                final long size  = (type != null) ? Math.multiplyExact(type.size, count) : 0;
                 if (size <= offsetSize) {
                     /*
                      * If the value can fit inside the number of bytes given by 'offsetSize', then the value is
@@ -333,7 +329,7 @@ final class Reader extends GeoTIFF {
             throws IOException, DataStoreException
     {
         if (deferredNeedsSort) {
-            Collections.sort(deferredEntries);                          // Sequential order in input stream.
+            deferredEntries.sort(null);                                 // Sequential order in input stream.
             deferredNeedsSort = false;
         }
         final long ignoreBefore = input.getStreamPosition() - origin;   // Avoid seeking back, unless we need to.
@@ -347,7 +343,7 @@ final class Reader extends GeoTIFF {
         for (final Iterator<DeferredEntry> it = deferredEntries.iterator(); it.hasNext();) {
             final DeferredEntry entry = it.next();
             if (entry.owner == dir || (entry.offset >= ignoreBefore && entry.offset <= ignoreAfter)) {
-                input.seek(JDK8.addExact(origin, entry.offset));
+                input.seek(Math.addExact(origin, entry.offset));
                 Object error;
                 try {
                     error = entry.owner.addEntry(entry.tag, entry.type, entry.count);

Modified: sis/trunk/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/Tags.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/Tags.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/Tags.java [UTF-8] (original)
+++ sis/trunk/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/Tags.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -211,6 +211,6 @@ final class Tags {
         } catch (IllegalAccessException e) {
             throw new AssertionError(e);        // Should never happen because we asked only for public fields.
         }
-        return Integer.toHexString(tag & 0xFFFF);
+        return Integer.toHexString(Short.toUnsignedInt(tag));
     }
 }

Modified: sis/trunk/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/Type.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/Type.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/Type.java [UTF-8] (original)
+++ sis/trunk/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/Type.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -27,7 +27,6 @@ import org.apache.sis.math.Vector;
 import org.apache.sis.util.ArraysExt;
 import org.apache.sis.util.resources.Errors;
 
-import org.apache.sis.internal.jdk8.JDK8;
 
 /**
  * The types of values in a TIFF header. Provides also some support for reading a value of a given type.
@@ -49,7 +48,7 @@ enum Type {
      *   <li>TIFF code: 7</li>
      * </ul>
      */
-    UNDEFINED(7, Byte.SIZE / Byte.SIZE, false),
+    UNDEFINED(7, Byte.BYTES, false),
 
     /**
      * An 8-bits signed (twos-complement) integer.
@@ -58,7 +57,7 @@ enum Type {
      *   <li>TIFF code: 6</li>
      * </ul>
      */
-    BYTE(6, Byte.SIZE / Byte.SIZE, false) {
+    BYTE(6, Byte.BYTES, false) {
         @Override long readLong(final ChannelDataInput input, final long count) throws IOException {
             ensureSingleton(count);
             return input.readByte();
@@ -76,7 +75,7 @@ enum Type {
      *   <li>TIFF code: 1</li>
      * </ul>
      */
-    UBYTE(1, Byte.SIZE / Byte.SIZE, true) {
+    UBYTE(1, Byte.BYTES, true) {
         @Override long readLong(final ChannelDataInput input, final long count) throws IOException {
             ensureSingleton(count);
             return input.readUnsignedByte();
@@ -94,7 +93,7 @@ enum Type {
      *   <li>TIFF code: 8</li>
      * </ul>
      */
-    SHORT(8, Short.SIZE / Byte.SIZE, false) {
+    SHORT(8, Short.BYTES, false) {
         @Override long readLong(final ChannelDataInput input, final long count) throws IOException {
             ensureSingleton(count);
             return input.readShort();
@@ -112,7 +111,7 @@ enum Type {
      *   <li>TIFF code: 3</li>
      * </ul>
      */
-    USHORT(3, Short.SIZE / Byte.SIZE, true) {
+    USHORT(3, Short.BYTES, true) {
         @Override long readLong(final ChannelDataInput input, final long count) throws IOException {
             ensureSingleton(count);
             return input.readUnsignedShort();
@@ -130,7 +129,7 @@ enum Type {
      *   <li>TIFF code: 9</li>
      * </ul>
      */
-    INT(9, Integer.SIZE / Byte.SIZE, false) {
+    INT(9, Integer.BYTES, false) {
         @Override long readLong(final ChannelDataInput input, final long count) throws IOException {
             ensureSingleton(count);
             return input.readInt();
@@ -148,7 +147,7 @@ enum Type {
      *   <li>TIFF code: 4</li>
      * </ul>
      */
-    UINT(4, Integer.SIZE / Byte.SIZE, true) {
+    UINT(4, Integer.BYTES, true) {
         @Override long readLong(final ChannelDataInput input, final long count) throws IOException {
             ensureSingleton(count);
             return input.readUnsignedInt();
@@ -165,7 +164,7 @@ enum Type {
      *   <li>TIFF code: 17</li>
      * </ul>
      */
-    LONG(17, Long.SIZE / Byte.SIZE, false) {
+    LONG(17, Long.BYTES, false) {
         @Override long readLong(final ChannelDataInput input, final long count) throws IOException {
             ensureSingleton(count);
             return input.readLong();
@@ -182,14 +181,14 @@ enum Type {
      *   <li>TIFF code: 16</li>
      * </ul>
      */
-    ULONG(16, Long.SIZE / Byte.SIZE, true) {
+    ULONG(16, Long.BYTES, true) {
         @Override long readLong(final ChannelDataInput input, final long count) throws IOException {
             ensureSingleton(count);
             final long value = input.readLong();
             if (value >= 0) {
                 return value;
             }
-            throw new ArithmeticException(canNotConvert(JDK8.toUnsignedString(value)));
+            throw new ArithmeticException(canNotConvert(Long.toUnsignedString(value)));
         }
 
         @Override double readDouble(final ChannelDataInput input, final long count) throws IOException {
@@ -209,7 +208,7 @@ enum Type {
      *   <li>TIFF code: 11</li>
      * </ul>
      */
-    FLOAT(11, Float.SIZE / Byte.SIZE, false) {
+    FLOAT(11, Float.BYTES, false) {
         @Override long readLong(final ChannelDataInput input, final long count) throws IOException {
             ensureSingleton(count);
             final float value = input.readFloat();
@@ -237,7 +236,7 @@ enum Type {
      *   <li>TIFF code: 12</li>
      * </ul>
      */
-    DOUBLE(12, Double.SIZE / Byte.SIZE, false) {
+    DOUBLE(12, Double.BYTES, false) {
         @Override long readLong(final ChannelDataInput input, final long count) throws IOException {
             ensureSingleton(count);
             final double value = input.readDouble();
@@ -265,7 +264,7 @@ enum Type {
      *   <li>TIFF code: 10</li>
      * </ul>
      */
-    RATIONAL(10, (2*Integer.SIZE / Byte.SIZE), false) {
+    RATIONAL(10, (2*Integer.BYTES), false) {
         @Override long readLong(final ChannelDataInput input, final long count) throws IOException {
             ensureSingleton(count);
             final int numerator   = input.readInt();
@@ -296,7 +295,7 @@ enum Type {
      *   <li>TIFF code: 5</li>
      * </ul>
      */
-    URATIONAL(5, (2*Integer.SIZE / Byte.SIZE), true) {
+    URATIONAL(5, (2*Integer.BYTES), true) {
         @Override long readLong(final ChannelDataInput input, final long count) throws IOException {
             ensureSingleton(count);
             final long numerator   = input.readUnsignedInt();
@@ -329,9 +328,9 @@ enum Type {
      *   <li>TIFF code: 2</li>
      * </ul>
      */
-    ASCII(2, Byte.SIZE / Byte.SIZE, false) {
+    ASCII(2, Byte.BYTES, false) {
         @Override String[] readString(final ChannelDataInput input, final long length, final Charset charset) throws IOException {
-            final byte[] chars = input.readBytes(JDK8.toIntExact(length));
+            final byte[] chars = input.readBytes(Math.toIntExact(length));
             String[] lines = new String[1];                     // We will usually have exactly one string.
             int count = 0, lower = 0;
             for (int i=0; i<chars.length; i++) {
@@ -494,7 +493,7 @@ enum Type {
         if (value >= 0) {
             return value;
         }
-        throw new ArithmeticException(canNotConvert(JDK8.toUnsignedString(value)));
+        throw new ArithmeticException(canNotConvert(Long.toUnsignedString(value)));
     }
 
     /**
@@ -550,7 +549,7 @@ enum Type {
      * @throws UnsupportedOperationException if this type is {@link #UNDEFINED}.
      */
     String[] readString(final ChannelDataInput input, final long length, final Charset charset) throws IOException {
-        final String[] s = new String[JDK8.toIntExact(length)];
+        final String[] s = new String[Math.toIntExact(length)];
         for (int i=0; i<s.length; i++) {
             s[i] = String.valueOf(readLong(input, 1));
         }
@@ -584,6 +583,6 @@ enum Type {
      * @throws UnsupportedOperationException if this type is {@link #UNDEFINED}.
      */
     final Vector readVector(final ChannelDataInput input, final long count) throws IOException {
-        return Vector.create(readArray(input, JDK8.toIntExact(count)), isUnsigned);
+        return Vector.create(readArray(input, Math.toIntExact(count)), isUnsigned);
     }
 }

Modified: sis/trunk/storage/sis-geotiff/src/test/java/org/apache/sis/storage/geotiff/GeoIdentifiers.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-geotiff/src/test/java/org/apache/sis/storage/geotiff/GeoIdentifiers.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-geotiff/src/test/java/org/apache/sis/storage/geotiff/GeoIdentifiers.java [UTF-8] (original)
+++ sis/trunk/storage/sis-geotiff/src/test/java/org/apache/sis/storage/geotiff/GeoIdentifiers.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -152,7 +152,7 @@ final class GeoIdentifiers {
         } catch (IllegalAccessException e) {
             throw new AssertionError(e);        // Should never happen because we asked only for public fields.
         }
-        return Integer.toHexString(tag & 0xFFFF);
+        return Integer.toHexString(Short.toUnsignedInt(tag));
     }
 
     /**

Modified: sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/DiscreteSampling.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/DiscreteSampling.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/DiscreteSampling.java [UTF-8] (original)
+++ sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/DiscreteSampling.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -16,7 +16,6 @@
  */
 package org.apache.sis.internal.netcdf;
 
-// Branch-dependent imports
 import org.opengis.metadata.Metadata;
 import org.apache.sis.storage.DataStore;
 import org.apache.sis.setup.GeometryLibrary;

Modified: sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Variable.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Variable.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Variable.java [UTF-8] (original)
+++ sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Variable.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -86,7 +86,7 @@ public abstract class Variable extends N
         buffer.append(getDataType().name().toLowerCase());
         final int[] shape = getGridEnvelope();
         for (int i=shape.length; --i>=0;) {
-            buffer.append('[').append(shape[i] & 0xFFFFFFFFL).append(']');
+            buffer.append('[').append(Integer.toUnsignedLong(shape[i])).append(']');
         }
         return buffer.toString();
     }
@@ -114,7 +114,7 @@ public abstract class Variable extends N
     public final boolean isCoverage(final int minSpan) {
         int numVectors = 0;                                     // Number of dimension having more than 1 value.
         for (final int length : getGridEnvelope()) {
-            if ((length & 0xFFFFFFFFL) >= minSpan) {
+            if (Integer.toUnsignedLong(length) >= minSpan) {
                 numVectors++;
             }
         }
@@ -236,7 +236,7 @@ public abstract class Variable extends N
         final StringBuilder buffer = new StringBuilder(getName()).append(" : ").append(getDataType());
         final int[] shape = getGridEnvelope();
         for (int i=shape.length; --i>=0;) {
-            buffer.append('[').append(shape[i] & 0xFFFFFFFFL).append(']');
+            buffer.append('[').append(Integer.toUnsignedLong(shape[i])).append(']');
         }
         return buffer.toString();
     }

Modified: sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java [UTF-8] (original)
+++ sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -62,8 +62,7 @@ import org.apache.sis.measure.Units;
 import ucar.nc2.constants.CF;
 
 // Branch-dependent imports
-import org.apache.sis.internal.jdk8.JDK8;
-import org.apache.sis.internal.jdk8.DateTimeException;
+import java.time.DateTimeException;
 
 
 /**
@@ -722,8 +721,8 @@ public final class ChannelDecoder extend
     public Date dateValue(final String name) {
         final Object value = findAttribute(name);
         if (value instanceof CharSequence) try {
-            return JDK8.parseDateTime(StandardDateFormat.dateToISO((CharSequence) value, 0, false));
-        } catch (IllegalArgumentException e) {
+            return StandardDateFormat.toDate(StandardDateFormat.FORMAT.parse((CharSequence) value));
+        } catch (DateTimeException | ArithmeticException e) {
             listeners.warning(null, e);
         }
         return null;
@@ -742,7 +741,7 @@ public final class ChannelDecoder extend
         final String[] parts = TIME_UNIT_PATTERN.split(symbol);
         if (parts.length == 2) try {
             final UnitConverter converter = Units.valueOf(parts[0]).getConverterToAny(Units.MILLISECOND);
-            final long epoch = JDK8.parseDateTime(StandardDateFormat.dateToISO(parts[1], 0, false)).getTime();
+            final long epoch = StandardDateFormat.toDate(StandardDateFormat.FORMAT.parse(parts[1])).getTime();
             for (int i=0; i<values.length; i++) {
                 final Number value = values[i];
                 if (value != null) {

Modified: sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/Dimension.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/Dimension.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/Dimension.java [UTF-8] (original)
+++ sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/Dimension.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -65,7 +65,7 @@ final class Dimension extends NamedEleme
      * Returns the number of grid cell value along this dimension.
      */
     final long length() {
-        return length & 0xFFFFFFFFL;
+        return Integer.toUnsignedLong(length);
     }
 
     /**

Modified: sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/FeaturesInfo.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/FeaturesInfo.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/FeaturesInfo.java [UTF-8] (original)
+++ sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/FeaturesInfo.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -37,11 +37,10 @@ import org.apache.sis.setup.GeometryLibr
 import ucar.nc2.constants.CF;
 
 // Branch-dependent imports
-import org.apache.sis.internal.jdk8.Spliterator;
-import org.apache.sis.internal.jdk8.Stream;
-import org.apache.sis.internal.jdk8.StreamSupport;
-import org.apache.sis.internal.jdk8.Consumer;
-import org.apache.sis.internal.jdk8.JDK8;
+import java.util.Spliterator;
+import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
+import java.util.function.Consumer;
 import org.apache.sis.feature.AbstractFeature;
 import org.apache.sis.feature.DefaultFeatureType;
 import org.apache.sis.feature.DefaultAttributeType;
@@ -296,6 +295,7 @@ search: for (final VariableInfo counts :
      *
      * @param  parallel  ignored, since current version does not support parallelism.
      */
+    @Override
     public Stream<AbstractFeature> features(boolean parallel) {
         return StreamSupport.stream(new Iter(), false);
     }
@@ -321,11 +321,6 @@ search: for (final VariableInfo counts :
         Iter() {
         }
 
-        @Override
-        public void forEachRemaining(Consumer<? super AbstractFeature> action) {
-            while (tryAdvance(action));
-        }
-
         /**
          * Executes the given action only on the next feature, if any.
          *
@@ -377,7 +372,7 @@ search: for (final VariableInfo counts :
             }
             feature.setPropertyValue("trajectory", factory.createPolyline(dimension, Vector.create(tmp, false)));
             action.accept(feature);
-            position = JDK8.addExact(position, length);
+            position = Math.addExact(position, length);
             return ++index < counts.size();
         }
 

Modified: sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/VariableInfo.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/VariableInfo.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/VariableInfo.java [UTF-8] (original)
+++ sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/VariableInfo.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -479,8 +479,8 @@ final class VariableInfo extends Variabl
         final int [] sub   = new int [dimension];
         for (int i=0; i<dimension; i++) {
             final int j = (dimension - 1) - i;
-            lower[i] = areaLower[j] & 0xFFFFFFFFL;
-            upper[i] = areaUpper[j] & 0xFFFFFFFFL;
+            lower[i] = Integer.toUnsignedLong(areaLower[j]);
+            upper[i] = Integer.toUnsignedLong(areaUpper[j]);
             sub  [i] = subsampling[j];
             size [i] = dimensions[j].length();
         }

Modified: sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/FeaturesWrapper.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/FeaturesWrapper.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/FeaturesWrapper.java [UTF-8] (original)
+++ sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/FeaturesWrapper.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -23,7 +23,7 @@ import org.apache.sis.util.logging.Warni
 import ucar.nc2.ft.FeatureCollection;
 
 // Branch-dependent imports
-import org.apache.sis.internal.jdk8.Stream;
+import java.util.stream.Stream;
 import org.apache.sis.feature.AbstractFeature;
 import org.apache.sis.feature.DefaultFeatureType;
 
@@ -62,6 +62,7 @@ final class FeaturesWrapper extends Disc
     /**
      * Returns the stream of features.
      */
+    @Override
     public Stream<AbstractFeature> features(boolean parallel) {
         throw new UnsupportedOperationException();      // TODO
     }

Modified: sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStore.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStore.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStore.java [UTF-8] (original)
+++ sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStore.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -38,9 +38,6 @@ import org.apache.sis.util.CharSequences
 import org.apache.sis.util.Version;
 import ucar.nc2.constants.CDM;
 
-// Branch-dependent imports
-import org.apache.sis.storage.ReadOnlyStorageException;
-
 
 /**
  * A data store backed by netCDF files.
@@ -172,7 +169,7 @@ public class NetcdfStore extends DataSto
     @SuppressWarnings("ReturnOfCollectionOrArrayField")
     public synchronized Collection<Resource> components() throws DataStoreException {
         if (components == null) try {
-            components = UnmodifiableArrayList.<Resource>wrap(decoder.getDiscreteSampling());
+            components = UnmodifiableArrayList.wrap(decoder.getDiscreteSampling());
         } catch (IOException e) {
             throw new DataStoreException(e);
         }
@@ -180,22 +177,6 @@ public class NetcdfStore extends DataSto
     }
 
     /**
-     * Unsupported operation in current version.
-     */
-    @Override
-    public Resource add(Resource resource) throws ReadOnlyStorageException {
-        throw new ReadOnlyStorageException();
-    }
-
-    /**
-     * Unsupported operation in current version.
-     */
-    @Override
-    public void remove(Resource resource) throws ReadOnlyStorageException {
-        throw new ReadOnlyStorageException();
-    }
-
-    /**
      * Closes this netCDF store and releases any underlying resources.
      *
      * @throws DataStoreException if an error occurred while closing the netCDF file.

Modified: sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java [UTF-8] (original)
+++ sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -172,7 +172,7 @@ public class NetcdfStoreProvider extends
         boolean isSupported = false;
         final ByteBuffer buffer = connector.getStorageAs(ByteBuffer.class);
         if (buffer != null) {
-            if (buffer.remaining() < Integer.SIZE / Byte.SIZE) {
+            if (buffer.remaining() < Integer.BYTES) {
                 return ProbeResult.INSUFFICIENT_BYTES;
             }
             final int header = buffer.getInt(buffer.position());

Modified: sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractDbase3ByteReader.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractDbase3ByteReader.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractDbase3ByteReader.java [UTF-8] (original)
+++ sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractDbase3ByteReader.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -111,7 +111,7 @@ abstract class AbstractDbase3ByteReader
     @Override public Date getDateOfLastUpdate() {
         return toDate(this.dbaseLastUpdate);
     }
-    
+
     /**
      * Returns the first record position, in bytes, in the DBase file.
      * @return First record position.
@@ -121,13 +121,13 @@ abstract class AbstractDbase3ByteReader
     }
 
     /**
-     * Returns the length (in bytes) of one record in this DBase file, including the delete flag. 
+     * Returns the length (in bytes) of one record in this DBase file, including the delete flag.
      * @return Record length.
      */
     @Override public short getRecordLength() {
         return this.recordLength;
     }
-    
+
     /**
      * Returns the record count.
      * @return Record count.
@@ -148,7 +148,7 @@ abstract class AbstractDbase3ByteReader
 
         // If no conversion has been found, decide if the cause is an unsupported value or an illegal value to choose the good exception to return.
         if (dbfCodePage == null) {
-            switch(codePageBinaryValue & 0xFF) {
+            switch(Byte.toUnsignedInt(codePageBinaryValue)) {
                 case 0x04: dbfCodePage = "unsupported"; break;
                 case 0x68: dbfCodePage = "unsupported"; break; // Kamenicky (Czech) MS-DOS
                 case 0x69: dbfCodePage = "unsupported"; break; // Mazovia (Polish) MS-DOS
@@ -246,9 +246,9 @@ abstract class AbstractDbase3ByteReader
         knownConversions.put(0xcb, "cp1253"); // Greek Windows
         knownConversions.put(0xcc, "cp1257"); // Baltic Windows
 
-        return(knownConversions.get(pageCodeBinaryValue & 0xFF));
+        return(knownConversions.get(Byte.toUnsignedInt(pageCodeBinaryValue)));
     }
-    
+
     /**
      * Set a charset.
      * @param cs Charset.

Modified: sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBase3FieldDescriptor.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBase3FieldDescriptor.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBase3FieldDescriptor.java [UTF-8] (original)
+++ sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBase3FieldDescriptor.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -20,9 +20,6 @@ import java.nio.MappedByteBuffer;
 
 import org.apache.sis.internal.shapefile.AutoChecker;
 
-// Branch-dependent imports
-import org.apache.sis.internal.jdk8.JDK8;
-
 
 /**
  * Field descriptor.
@@ -105,7 +102,7 @@ public class DBase3FieldDescriptor exten
      * @return Decimal count.
      */
     public int getDecimalCount() {
-        return this.fieldDecimalCount & 0xFF;
+        return Byte.toUnsignedInt(this.fieldDecimalCount);
     }
 
     /**
@@ -113,7 +110,7 @@ public class DBase3FieldDescriptor exten
      * @return field length.
      */
     public int getLength() {
-        return this.fieldLength & 0xFF;
+        return Byte.toUnsignedInt(this.fieldLength);
     }
 
     /**
@@ -124,7 +121,7 @@ public class DBase3FieldDescriptor exten
         // Converting bytes to String takes time. Only do that once.
         if (this.stringFieldName == null) {
             int length = this.fieldName.length;
-            while (length != 0 && JDK8.toUnsignedInt(this.fieldName[length - 1]) <= ' ') {
+            while (length != 0 && Byte.toUnsignedInt(this.fieldName[length - 1]) <= ' ') {
                 length--;
             }
 
@@ -147,7 +144,7 @@ public class DBase3FieldDescriptor exten
      */
     @Override
     public String toString() {
-        String text = format("toString", getName(), this.fieldType, JDK8.toUnsignedInt(this.fieldLength), JDK8.toUnsignedInt(this.fieldDecimalCount));
+        String text = format("toString", getName(), this.fieldType, Byte.toUnsignedInt(this.fieldLength), Byte.toUnsignedInt(this.fieldDecimalCount));
         return text;
     }
 }

Modified: sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/MappedByteReader.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/MappedByteReader.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/MappedByteReader.java [UTF-8] (original)
+++ sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/MappedByteReader.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -28,9 +28,6 @@ import org.apache.sis.internal.shapefile
 import org.apache.sis.internal.shapefile.jdbc.resultset.SQLNoSuchFieldException;
 import org.apache.sis.feature.AbstractFeature;
 
-// Branch-dependent imports
-import org.apache.sis.internal.jdk8.JDK8;
-
 
 /**
  * Reader of a Database Binary content by the way of a {@link java.nio.MappedByteBuffer}
@@ -86,7 +83,7 @@ public class MappedByteReader extends Ab
             getByteBuffer().get(data);
 
             int length = data.length;
-            while (length != 0 && JDK8.toUnsignedInt(data[length - 1]) <= ' ') {
+            while (length != 0 && Byte.toUnsignedInt(data[length - 1]) <= ' ') {
                 length--;
             }
 
@@ -129,7 +126,7 @@ public class MappedByteReader extends Ab
      */
     @Override public int getRowNum() {
         int position = getByteBuffer().position();
-        int recordNumber = (position - (firstRecordPosition & 0xFFFF)) / (recordLength & 0xFFFF);
+        int recordNumber = (position - Short.toUnsignedInt(this.firstRecordPosition)) / Short.toUnsignedInt(this.recordLength);
         return recordNumber;
     }
 
@@ -152,7 +149,7 @@ public class MappedByteReader extends Ab
             // Trim the bytes right.
             int length = data.length;
 
-            while (length != 0 && JDK8.toUnsignedInt(data[length - 1]) <= ' ') {
+            while (length != 0 && Byte.toUnsignedInt(data[length - 1]) <= ' ') {
                 length--;
             }
 

Modified: sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/connection/DBFConnection.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/connection/DBFConnection.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/connection/DBFConnection.java [UTF-8] (original)
+++ sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/connection/DBFConnection.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -22,6 +22,7 @@ import java.nio.charset.Charset;
 import java.sql.*;
 import java.util.*;
 import java.util.logging.Level;
+import java.util.stream.Collectors;
 
 import org.apache.sis.internal.shapefile.jdbc.*;
 import org.apache.sis.internal.shapefile.jdbc.metadata.DBFDatabaseMetaData;
@@ -80,7 +81,7 @@ public class DBFConnection extends Abstr
             // Check if all the underlying connections that has been opened with this connection has been closed.
             // If not, we log a warning to help the developper.
             if (this.openedStatements.size() > 0) {
-                log(Level.WARNING, "log.statements_left_opened", this.openedStatements.size(), openedStatements.toString());
+                log(Level.WARNING, "log.statements_left_opened", this.openedStatements.size(), this.openedStatements.stream().map(DBFStatement::toString).collect(Collectors.joining(", ")));
             }
 
             this.byteReader.close();

Modified: sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFRecordBasedResultSet.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFRecordBasedResultSet.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFRecordBasedResultSet.java [UTF-8] (original)
+++ sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFRecordBasedResultSet.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -26,6 +26,7 @@ import java.sql.SQLFeatureNotSupportedEx
 import java.util.Calendar;
 import java.util.GregorianCalendar;
 import java.util.Map;
+import java.util.function.Function;
 import java.util.logging.Level;
 
 import org.apache.sis.internal.shapefile.jdbc.SQLConnectionClosedException;
@@ -34,10 +35,6 @@ import org.apache.sis.internal.shapefile
 import org.apache.sis.internal.shapefile.jdbc.sql.*;
 import org.apache.sis.internal.shapefile.jdbc.statement.DBFStatement;
 
-// Branch-dependent imports
-import org.apache.sis.internal.jdk8.Function;
-
-
 /**
  * A ResultSet based on a record.
  * @author Marc LE BIHAN
@@ -51,10 +48,10 @@ public class DBFRecordBasedResultSet ext
 
     /** Indicates that the last result set record matching conditions has already been returned, and a further call of next() shall throw a "no more record" exception. */
     private boolean lastResultSetRecordAlreadyReturned;
-    
+
     /** The record number of this record. */
     private int recordNumber;
-    
+
     /**
      * Constructs a result set.
      * @param stmt Parent statement.
@@ -205,11 +202,7 @@ public class DBFRecordBasedResultSet ext
     public double getDouble(String columnLabel) throws SQLConnectionClosedException, SQLNoSuchFieldException, SQLNotNumericException {
         logStep("getDouble", columnLabel);
 
-        Double value = getNumeric(columnLabel, new Function<String,Double>() {
-            @Override public Double apply(final String value) {
-                return Double.parseDouble(value);
-            }
-        });
+        Double value = getNumeric(columnLabel, Double::parseDouble);
         this.wasNull = (value == null);
         return value != null ? value : 0.0; // The ResultSet contract for numbers is to return 0 when a null value is encountered.
     }
@@ -237,11 +230,7 @@ public class DBFRecordBasedResultSet ext
     public float getFloat(String columnLabel) throws SQLConnectionClosedException, SQLNoSuchFieldException, SQLNotNumericException {
         logStep("getFloat", columnLabel);
 
-        Float value = getNumeric(columnLabel, new Function<String,Float>() {
-            @Override public Float apply(final String value) {
-                return Float.parseFloat(value);
-            }
-        });
+        Float value = getNumeric(columnLabel, Float::parseFloat);
         this.wasNull = (value == null);
         return value != null ? value : 0; // The ResultSet contract for numbers is to return 0 when a null value is encountered.
     }
@@ -269,11 +258,7 @@ public class DBFRecordBasedResultSet ext
     public int getInt(String columnLabel) throws SQLConnectionClosedException, SQLNoSuchFieldException, SQLNotNumericException {
         logStep("getInt", columnLabel);
 
-        Integer value = getNumeric(columnLabel, new Function<String,Integer>() {
-            @Override public Integer apply(final String value) {
-                return Integer.parseInt(value);
-            }
-        });
+        Integer value = getNumeric(columnLabel, Integer::parseInt);
         this.wasNull = (value == null);
         return value != null ? value : 0; // The ResultSet contract for numbers is to return 0 when a null value is encountered.
     }
@@ -301,11 +286,7 @@ public class DBFRecordBasedResultSet ext
     public long getLong(String columnLabel) throws SQLConnectionClosedException, SQLNoSuchFieldException, SQLNotNumericException {
         logStep("getLong", columnLabel);
 
-        Long value = getNumeric(columnLabel, new Function<String,Long>() {
-            @Override public Long apply(final String value) {
-                return Long.parseLong(value);
-            }
-        });
+        Long value = getNumeric(columnLabel, Long::parseLong);
         this.wasNull = (value == null);
         return value != null ? value : 0; // The ResultSet contract for numbers is to return 0 when a null value is encountered.
     }
@@ -415,7 +396,7 @@ public class DBFRecordBasedResultSet ext
     @Override
     public Object getObject(String columnLabel) throws SQLConnectionClosedException, SQLFeatureNotSupportedException, SQLNoSuchFieldException, SQLNotNumericException, SQLNotDateException {
         int index = -1;
-        
+
         try {
             index = findColumn(columnLabel);
             return getObject(index);
@@ -433,7 +414,7 @@ public class DBFRecordBasedResultSet ext
     public int getRowNum()  {
         return this.recordNumber;
     }
-    
+
     /**
      * @see java.sql.ResultSet#getShort(java.lang.String)
      * @throws SQLConnectionClosedException if the connection is closed.
@@ -444,11 +425,7 @@ public class DBFRecordBasedResultSet ext
     public short getShort(String columnLabel) throws SQLConnectionClosedException, SQLNoSuchFieldException, SQLNotNumericException {
         logStep("getShort", columnLabel);
 
-        Short value = getNumeric(columnLabel, new Function<String,Short>() {
-            @Override public Short apply(final String value) {
-                return Short.parseShort(value);
-            }
-        });
+        Short value = getNumeric(columnLabel, Short::parseShort);
         this.wasNull = (value == null);
         return value != null ? value : 0; // The ResultSet contract for numbers is to return 0 when a null value is encountered.
     }
@@ -492,7 +469,7 @@ public class DBFRecordBasedResultSet ext
         // If a non null value has been readed, convert it to the wished Charset (provided one has been given).
         DBFConnection cnt = (DBFConnection)((DBFStatement)getStatement()).getConnection();
         Charset charset = cnt.getCharset();
-        
+
         if (charset == null) {
             return new String(bytes);
         }
@@ -605,7 +582,7 @@ public class DBFRecordBasedResultSet ext
 
         try(DBFBuiltInMemoryResultSetForColumnsListing rs = (DBFBuiltInMemoryResultSetForColumnsListing)getFieldDesc(columnLabel, this.sql)) {
             String textValue = getString(columnLabel);
-            
+
             if (textValue == null) {
                 return null;
             }

Modified: sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/sql/ClauseResolver.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/sql/ClauseResolver.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/sql/ClauseResolver.java [UTF-8] (original)
+++ sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/sql/ClauseResolver.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -17,17 +17,13 @@
 package org.apache.sis.internal.shapefile.jdbc.sql;
 
 import java.util.Objects;
+import java.util.function.Function;
 import java.util.logging.Level;
 
 import org.apache.sis.internal.shapefile.AutoChecker;
 import org.apache.sis.internal.shapefile.jdbc.SQLConnectionClosedException;
 import org.apache.sis.internal.shapefile.jdbc.resultset.*;
 
-// Branch-dependent imports
-import org.apache.sis.internal.jdk8.Function;
-import org.apache.sis.util.Numbers;
-
-
 /**
  * Base class for clause resolver.
  * @author Marc LE BIHAN
@@ -176,21 +172,34 @@ public abstract class ClauseResolver ext
         }
         else {
             // Else, attempt to promote their types to something equivalent on the two sides.
-            if (value1 instanceof Number && value2 instanceof Number) {
-                // Promote Short to Integer, Long, Float or Double.
-                final Class<? extends Number> widestClass = Numbers.widestClass(
-                        value1.getClass().asSubclass(Number.class),
-                        value2.getClass().asSubclass(Number.class));
-                Number n1 = Numbers.cast((Number) value1, widestClass);
-                Number n2 = Numbers.cast((Number) value2, widestClass);
-                return compare(rs, n1, n2);
-            }
 
-            // if we are here, we have found no matching at all.
+            // Promote Short to Integer, Long, Float or Double.
+            Integer compare = compareIfPromoted(rs, value1, value2, Short.class, Integer.class, Integer::valueOf);
+            compare = compare != null ? compare : compareIfPromoted(rs, value1, value2, Short.class, Long.class, Long::valueOf);
+            compare = compare != null ? compare : compareIfPromoted(rs, value1, value2, Short.class, Float.class, Float::valueOf);
+            compare = compare != null ? compare : compareIfPromoted(rs, value1, value2, Short.class, Double.class, Double::valueOf);
+
+            // Promote Integer to Long, Float or Double.
+            compare = compare != null ? compare : compareIfPromoted(rs, value1, value2, Integer.class, Long.class, Long::valueOf);
+            compare = compare != null ? compare : compareIfPromoted(rs, value1, value2, Integer.class, Float.class, Float::valueOf);
+            compare = compare != null ? compare : compareIfPromoted(rs, value1, value2, Integer.class, Double.class, Double::valueOf);
+
+            // Promote Long to Float or Double.
+            compare = compare != null ? compare : compareIfPromoted(rs, value1, value2, Long.class, Float.class, Float::valueOf);
+            compare = compare != null ? compare : compareIfPromoted(rs, value1, value2, Long.class, Double.class, Double::valueOf);
+
+            // Promote Float to Double.
+            compare = compare != null ? compare : compareIfPromoted(rs, value1, value2, Float.class, Double.class, Double::valueOf);
+
+            // if we are here with still a null value in comparison result, we have found no matching at all.
             // Default to String comparison.
-            String default1 = value1.toString();
-            String default2 = value2.toString();
-            return compare(rs, default1, default2);
+            if (compare == null) {
+                String default1 = value1.toString();
+                String default2 = value2.toString();
+                return compare(rs, default1, default2);
+            }
+            else
+                return compare;
         }
     }
 

Modified: sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/statement/DBFStatement.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/statement/DBFStatement.java?rev=1822268&r1=1822267&r2=1822268&view=diff
==============================================================================
--- sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/statement/DBFStatement.java [UTF-8] (original)
+++ sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/statement/DBFStatement.java [UTF-8] Fri Jan 26 10:48:27 2018
@@ -22,6 +22,7 @@ import java.text.MessageFormat;
 import java.util.HashSet;
 import java.util.Objects;
 import java.util.logging.Level;
+import java.util.stream.Collectors;
 
 import org.apache.sis.internal.shapefile.jdbc.SQLConnectionClosedException;
 import org.apache.sis.internal.shapefile.jdbc.connection.DBFConnection;
@@ -163,7 +164,7 @@ public class DBFStatement extends Abstra
         // Check if all the underlying ResultSets that has been opened with this statement has been closed.
         // If not, we log a warning to help the developper.
         if (this.openedResultSets.size() > 0) {
-            log(Level.WARNING, "log.resultsets_left_opened", this.openedResultSets.size(), openedResultSets.toString());
+            log(Level.WARNING, "log.resultsets_left_opened", this.openedResultSets.size(), this.openedResultSets.stream().map(DBFResultSet::toString).collect(Collectors.joining(", ")));
         }
 
         this.isClosed = true;



Mime
View raw message