Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java [UTF-8] (original) +++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -71,7 +71,6 @@ import org.apache.sis.util.Classes; import org.apache.sis.util.iso.Types; // Branch-dependent imports -import org.apache.sis.internal.jdk8.JDK8; import org.apache.sis.internal.geoapi.evolution.Interim; @@ -371,11 +370,7 @@ public class MetadataSource implements A this.tableColumns = new HashMap<>(); this.pool = new WeakValueHashMap<>(CacheKey.class); this.listeners = new WarningListeners<>(this); - this.lastUsed = new ThreadLocal<LookupInfo>() { - @Override protected LookupInfo initialValue() { - return new LookupInfo(); - } - }; + this.lastUsed = ThreadLocal.withInitial(LookupInfo::new); } /** @@ -918,7 +913,7 @@ public class MetadataSource implements A * Note that the usage of 'result' must stay inside this synchronized block * because we can not assume that JDBC connections are thread-safe. */ - CachedStatement result = take(type, JDK8.toUnsignedInt(toSearch.preferredIndex)); + CachedStatement result = take(type, Byte.toUnsignedInt(toSearch.preferredIndex)); if (result == null) { final SQLBuilder helper = helper(); final String query = helper.clear().append("SELECT * FROM ") @@ -933,7 +928,7 @@ public class MetadataSource implements A value = array.getArray(); array.free(); } - toSearch.preferredIndex = (byte) recycle(result, JDK8.toUnsignedInt(toSearch.preferredIndex)); + toSearch.preferredIndex = (byte) recycle(result, Byte.toUnsignedInt(toSearch.preferredIndex)); } } /* @@ -1011,7 +1006,7 @@ public class MetadataSource implements A } final Set<E> enumeration; if (CodeList.class.isAssignableFrom(elementType)) { - enumeration = new CodeListSet((Class) elementType); + enumeration = new CodeListSet<>((Class) elementType); } else if (Enum.class.isAssignableFrom(elementType)) { enumeration = EnumSet.noneOf((Class) elementType); } else { @@ -1022,7 +1017,7 @@ public class MetadataSource implements A if (Set.class.isAssignableFrom(returnType)) { if (SortedSet.class.isAssignableFrom(returnType)) { if (collection.isEmpty()) { - collection = CollectionsExt.emptySortedSet(); + collection = Collections.emptySortedSet(); } else { collection = Collections.unmodifiableSortedSet(new TreeSet<>(collection)); }
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataWriter.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataWriter.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataWriter.java [UTF-8] (original) +++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataWriter.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -193,7 +193,7 @@ public class MetadataWriter extends Meta if (metadata instanceof CodeList<?>) { identifier = addCode(stmt, (CodeList<?>) metadata); } else { - identifier = add(stmt, metadata, new IdentityHashMap<Object,String>(), null); + identifier = add(stmt, metadata, new IdentityHashMap<>(), null); } } success = true; Modified: sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/ElementTest.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/ElementTest.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/ElementTest.java [UTF-8] (original) +++ sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/ElementTest.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -42,7 +42,7 @@ public final strictfp class ElementTest /** * A dummy parser to be given to the {@link Element} constructor. */ - private final AbstractParser parser = new AbstractParser(Symbols.SQUARE_BRACKETS, new HashMap<String,Element>(2), + private final AbstractParser parser = new AbstractParser(Symbols.SQUARE_BRACKETS, new HashMap<>(2), null, null, null, Locale.ENGLISH) { @Override String getPublicFacade() { Modified: sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/APIVerifier.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/APIVerifier.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/APIVerifier.java [UTF-8] (original) +++ sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/APIVerifier.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -198,8 +198,8 @@ public final strictfp class APIVerifier oldMethod = null; } if (oldMethod != null) { - final String oldType = oldMethod.getGenericReturnType().toString(); - final String newType = newMethod.getGenericReturnType().toString(); + final String oldType = oldMethod.getGenericReturnType().getTypeName(); + final String newType = newMethod.getGenericReturnType().getTypeName(); if (!newType.equals(oldType)) { incompatibleChanges.add(className + '.' + methodName + lineSeparator + " (old) " + oldType + lineSeparator Modified: sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/CustomMetadataTest.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/CustomMetadataTest.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/CustomMetadataTest.java [UTF-8] (original) +++ sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/CustomMetadataTest.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -68,13 +68,11 @@ public final strictfp class CustomMetada * A trivial metadata implementation which return the method name * for every attribute of type InternationalString. */ - final InvocationHandler handler = new InvocationHandler() { - @Override public Object invoke(Object proxy, Method method, Object[] args) { - if (method.getReturnType() == InternationalString.class) { - return new SimpleInternationalString(method.getName()); - } - return null; + final InvocationHandler handler = (Object proxy, Method method, Object[] args) -> { + if (method.getReturnType() == InternationalString.class) { + return new SimpleInternationalString(method.getName()); } + return null; }; Citation data = (Citation) Proxy.newProxyInstance(getClass().getClassLoader(), new Class<?>[] { Citation.class }, handler); Modified: sis/trunk/core/sis-raster/src/main/java/org/apache/sis/image/DefaultIterator.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-raster/src/main/java/org/apache/sis/image/DefaultIterator.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-raster/src/main/java/org/apache/sis/image/DefaultIterator.java [UTF-8] (original) +++ sis/trunk/core/sis-raster/src/main/java/org/apache/sis/image/DefaultIterator.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -32,9 +32,6 @@ import java.nio.DoubleBuffer; import org.apache.sis.internal.raster.Resources; import org.apache.sis.util.ArgumentChecks; -// Branch-dependent imports -import org.apache.sis.internal.jdk8.JDK8; - /** * Default iterator used when no specialized implementation is available. @@ -92,7 +89,7 @@ final class DefaultIterator extends Writ currentLowerX = lowerX; currentUpperX = upperX; currentUpperY = upperY; - x = JDK8.decrementExact(lowerX); // Set the position before first pixel. + x = Math.decrementExact(lowerX); // Set the position before first pixel. y = lowerY; } @@ -107,12 +104,12 @@ final class DefaultIterator extends Writ */ DefaultIterator(final RenderedImage input, final WritableRenderedImage output, final Rectangle subArea, final Dimension window) { super(input, output, subArea, window); - tileX = JDK8.decrementExact(tileLowerX); + tileX = Math.decrementExact(tileLowerX); tileY = tileLowerY; currentLowerX = lowerX; currentUpperX = lowerX; // Really 'lower', so the position is the tile before the first tile. currentUpperY = lowerY; - x = JDK8.decrementExact(lowerX); // Set the position before first pixel. + x = Math.decrementExact(lowerX); // Set the position before first pixel. y = lowerY; } @@ -171,8 +168,8 @@ final class DefaultIterator extends Writ throw new IndexOutOfBoundsException(Resources.format(Resources.Keys.CoordinateOutsideDomain_2, px, py)); } if (image != null) { - final int tx = JDK8.floorDiv(px - tileGridXOffset, tileWidth); - final int ty = JDK8.floorDiv(py - tileGridYOffset, tileHeight); + final int tx = Math.floorDiv(px - tileGridXOffset, tileWidth); + final int ty = Math.floorDiv(py - tileGridYOffset, tileHeight); if (tx != tileX || ty != tileY) { close(); // Release current writable raster, if any. tileX = tx; @@ -197,7 +194,7 @@ final class DefaultIterator extends Writ if (++y >= currentUpperY) { // Strict equality (==) would work, but use >= as a safety. close(); // Release current writable raster, if any. if (++tileX >= tileUpperX) { // Strict equality (==) would work, but use >= as a safety. - tileY = JDK8.incrementExact(tileY); // 'incrementExact' because 'tileY > tileUpperY' is allowed. + tileY = Math.incrementExact(tileY); // 'incrementExact' because 'tileY > tileUpperY' is allowed. if (tileY >= tileUpperY) { /* * Paranoiac safety: keep the x, y and tileX values before their maximal values Modified: sis/trunk/core/sis-raster/src/main/java/org/apache/sis/image/PixelIterator.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-raster/src/main/java/org/apache/sis/image/PixelIterator.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-raster/src/main/java/org/apache/sis/image/PixelIterator.java [UTF-8] (original) +++ sis/trunk/core/sis-raster/src/main/java/org/apache/sis/image/PixelIterator.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -26,9 +26,8 @@ import java.awt.image.WritableRaster; import java.awt.image.WritableRenderedImage; import java.util.NoSuchElementException; import org.apache.sis.util.ArgumentChecks; -import org.apache.sis.internal.jdk8.JDK8; -import static org.apache.sis.internal.jdk8.JDK8.floorDiv; +import static java.lang.Math.floorDiv; /** @@ -133,8 +132,8 @@ public abstract class PixelIterator { bounds = intersection(tileGridXOffset, tileGridYOffset, tileWidth, tileHeight, subArea, window); lowerX = bounds.x; lowerY = bounds.y; - upperX = JDK8.addExact(lowerX, bounds.width); - upperY = JDK8.addExact(lowerY, bounds.height); + upperX = Math.addExact(lowerX, bounds.width); + upperY = Math.addExact(lowerY, bounds.height); windowWidth = (window != null) ? window.width : 0; windowHeight = (window != null) ? window.height : 0; } @@ -158,12 +157,12 @@ public abstract class PixelIterator { bounds = intersection(data.getMinX(), data.getMinY(), data.getWidth(), data.getHeight(), subArea, window); lowerX = bounds.x; lowerY = bounds.y; - upperX = JDK8.addExact(lowerX, bounds.width); - upperY = JDK8.addExact(lowerY, bounds.height); - tileLowerX = floorDiv(JDK8.subtractExact(lowerX, tileGridXOffset), tileWidth); - tileLowerY = floorDiv(JDK8.subtractExact(lowerY, tileGridYOffset), tileHeight); - tileUpperX = ceilDiv(JDK8.subtractExact(upperX, tileGridXOffset), tileWidth); - tileUpperY = ceilDiv(JDK8.subtractExact(upperY, tileGridYOffset), tileHeight); + upperX = Math.addExact(lowerX, bounds.width); + upperY = Math.addExact(lowerY, bounds.height); + tileLowerX = floorDiv(Math.subtractExact(lowerX, tileGridXOffset), tileWidth); + tileLowerY = floorDiv(Math.subtractExact(lowerY, tileGridYOffset), tileHeight); + tileUpperX = ceilDiv(Math.subtractExact(upperX, tileGridXOffset), tileWidth); + tileUpperY = ceilDiv(Math.subtractExact(upperY, tileGridYOffset), tileHeight); windowWidth = (window != null) ? window.width : 0; windowHeight = (window != null) ? window.height : 0; } Modified: sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/AbstractLocationType.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/AbstractLocationType.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/AbstractLocationType.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/AbstractLocationType.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -69,8 +69,7 @@ abstract class AbstractLocationType impl */ public static List<AbstractLocationType> snapshot(final ReferencingByIdentifiers rs, final AbstractLocationType... types) { ArgumentChecks.ensureNonNull("types", types); - final List<AbstractLocationType> snapshot = FinalLocationType.snapshot(Arrays.asList(types), rs, - new IdentityHashMap<AbstractLocationType,FinalLocationType>()); + final List<AbstractLocationType> snapshot = FinalLocationType.snapshot(Arrays.asList(types), rs, new IdentityHashMap<>()); final Map<AbstractLocationType,Boolean> parents = new IdentityHashMap<>(); for (final AbstractLocationType type : snapshot) { checkForCycles(type, parents); @@ -100,7 +99,7 @@ abstract class AbstractLocationType impl * @throws IllegalArgumentException if an infinite recursivity is detected. */ final void checkForCycles() { - checkForCycles(this, new IdentityHashMap<AbstractLocationType,Boolean>()); + checkForCycles(this, new IdentityHashMap<>()); } /** Modified: sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/GeohashReferenceSystem.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/GeohashReferenceSystem.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/GeohashReferenceSystem.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/GeohashReferenceSystem.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -277,7 +277,7 @@ public class GeohashReferenceSystem exte final int highestOneBit = format.highestOneBit; char[] geohash = buffer; if (geohash == null) { - buffer = geohash = new char[length & 0xFF]; + buffer = geohash = new char[Byte.toUnsignedInt(length)]; } /* * The current implementation assumes a two-dimensional coordinates. The 'isEven' boolean takes Modified: sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -62,12 +62,11 @@ import org.apache.sis.measure.Longitude; import org.apache.sis.measure.Latitude; // Branch-dependent imports -import org.apache.sis.internal.jdk8.JDK8; -import org.apache.sis.internal.jdk8.Spliterator; -import org.apache.sis.internal.jdk8.Spliterators; -import org.apache.sis.internal.jdk8.Stream; -import org.apache.sis.internal.jdk8.Consumer; -import org.apache.sis.internal.jdk8.StreamSupport; +import java.util.Spliterator; +import java.util.Spliterators; +import java.util.stream.Stream; +import java.util.function.Consumer; +import java.util.stream.StreamSupport; import org.apache.sis.metadata.iso.citation.AbstractParty; @@ -454,7 +453,7 @@ public class MilitaryGridReferenceSystem */ public void setPrecision(final double precision) { final double p = Math.floor(Math.log10(precision)); - if (!JDK8.isFinite(p)) { + if (!Double.isFinite(p)) { throw new IllegalArgumentException(Errors.format(Errors.Keys.IllegalArgumentValue_2, "precision", precision)); } // The -3 is an arbitrary limit to millimetre precision. @@ -613,8 +612,7 @@ public class MilitaryGridReferenceSystem * @return a stream of MGRS references intersecting the given area of interest. * @throws TransformException if an error occurred while transforming the area of interest. */ - // Public on the JDK8 branch only. - final Stream<String> encode(final Envelope areaOfInterest, final boolean parallel) throws TransformException { + public Stream<String> encode(final Envelope areaOfInterest, final boolean parallel) throws TransformException { ArgumentChecks.ensureNonNull("areaOfInterest", areaOfInterest); try { return StreamSupport.stream(new IteratorAllZones(areaOfInterest).simplify(), parallel); Modified: sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/ModifiableLocationType.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/ModifiableLocationType.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/ModifiableLocationType.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/ModifiableLocationType.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -32,8 +32,7 @@ import org.apache.sis.util.ArgumentCheck import org.apache.sis.util.iso.Types; // Branch-dependent imports -import org.apache.sis.internal.jdk8.JDK8; -import org.apache.sis.internal.jdk8.Function; +import java.util.function.Function; import org.apache.sis.metadata.iso.citation.AbstractParty; @@ -214,11 +213,7 @@ public class ModifiableLocationType exte */ @Override public InternationalString getTheme() { - return (theme != null) ? theme : inherit(new Function<ModifiableLocationType, InternationalString>() { - @Override public InternationalString apply(final ModifiableLocationType type) { - return type.getTheme(); - } - }); + return (theme != null) ? theme : inherit(ModifiableLocationType::getTheme); } /** @@ -258,11 +253,8 @@ public class ModifiableLocationType exte */ @Override public Collection<InternationalString> getIdentifications() { - return identifications.isEmpty() ? inherit(new Function<ModifiableLocationType, Collection<InternationalString>>() { - @Override public Collection<InternationalString> apply(final ModifiableLocationType type) { - return type.getIdentifications(); - } - }) : Collections.unmodifiableCollection(identifications.values()); + return identifications.isEmpty() ? inherit(ModifiableLocationType::getIdentifications) + : Collections.unmodifiableCollection(identifications.values()); } /** @@ -277,7 +269,7 @@ public class ModifiableLocationType exte public void addIdentification(final CharSequence value) { ArgumentChecks.ensureNonNull("value", value); final String key = value.toString(); - if (JDK8.putIfAbsent(identifications, key, Types.toInternationalString(value)) != null) { + if (identifications.putIfAbsent(key, Types.toInternationalString(value)) != null) { throw new IllegalArgumentException(Errors.format(Errors.Keys.ElementAlreadyPresent_1, key)); } } @@ -306,11 +298,7 @@ public class ModifiableLocationType exte */ @Override public InternationalString getDefinition() { - return (definition != null) ? definition : inherit(new Function<ModifiableLocationType, InternationalString>() { - @Override public InternationalString apply(final ModifiableLocationType type) { - return type.getDefinition(); - } - }); + return (definition != null) ? definition : inherit(ModifiableLocationType::getDefinition); } /** @@ -334,11 +322,7 @@ public class ModifiableLocationType exte */ @Override public GeographicExtent getTerritoryOfUse() { - return (territoryOfUse != null) ? territoryOfUse : inherit(new Function<ModifiableLocationType, GeographicExtent>() { - @Override public GeographicExtent apply(final ModifiableLocationType type) { - return type.getTerritoryOfUse(); - } - }); + return (territoryOfUse != null) ? territoryOfUse : inherit(ModifiableLocationType::getTerritoryOfUse); } /** @@ -382,11 +366,7 @@ public class ModifiableLocationType exte */ @Override public AbstractParty getOwner() { - return (owner != null) ? owner : inherit(new Function<ModifiableLocationType, AbstractParty>() { - @Override public AbstractParty apply(final ModifiableLocationType type) { - return type.getOwner(); - } - }); + return (owner != null) ? owner : inherit(ModifiableLocationType::getOwner); } /** @@ -456,11 +436,11 @@ public class ModifiableLocationType exte public void addParent(final ModifiableLocationType parent) { ArgumentChecks.ensureNonNull("parent", parent); final String parentName = parent.name.toString(); - if (JDK8.putIfAbsent(parents, parentName, parent) != null) { + if (parents.putIfAbsent(parentName, parent) != null) { throw new IllegalStateException(Resources.format(Resources.Keys.ParentAlreadyExists_1, parentName)); } final String childName = name.toString(); - if (JDK8.putIfAbsent(parent.children, childName, this) != null) { + if (parent.children.putIfAbsent(childName, this) != null) { if (parents.remove(parentName) != parent) { throw new ConcurrentModificationException(); // Paranoiac check. } Modified: sis/trunk/core/sis-referencing-by-identifiers/src/test/java/org/apache/sis/referencing/gazetteer/LocationViewer.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing-by-identifiers/src/test/java/org/apache/sis/referencing/gazetteer/LocationViewer.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-referencing-by-identifiers/src/test/java/org/apache/sis/referencing/gazetteer/LocationViewer.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing-by-identifiers/src/test/java/org/apache/sis/referencing/gazetteer/LocationViewer.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -41,9 +41,6 @@ import org.apache.sis.referencing.Common import org.apache.sis.referencing.CRS; import org.apache.sis.util.Debug; -// Branch-dependent imports -import org.apache.sis.internal.jdk8.JDK8; - /** * A Swing panel drawing {@code Location} instances. @@ -220,7 +217,7 @@ public final class LocationViewer extend final MathTransform2D tr = (MathTransform2D) CRS.findOperation( envelope.getCoordinateReferenceSystem(), displayCRS, null).getMathTransform(); final Shape shape = tr.createTransformedShape(new IntervalRectangle(envelope)); - if (JDK8.putIfAbsent(locations, label, shape) != null) { + if (locations.putIfAbsent(label, shape) != null) { throw new IllegalArgumentException("A location is already defined for " + label); } final Rectangle2D b = shape.getBounds2D(); Modified: sis/trunk/core/sis-referencing-by-identifiers/src/test/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystemTest.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing-by-identifiers/src/test/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystemTest.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-referencing-by-identifiers/src/test/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystemTest.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing-by-identifiers/src/test/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystemTest.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -23,6 +23,7 @@ import java.util.List; import java.util.Locale; import java.util.Random; import java.util.Iterator; +import java.util.Collections; import java.lang.reflect.Field; import org.opengis.referencing.crs.ProjectedCRS; import org.opengis.referencing.operation.MathTransform; @@ -777,5 +778,13 @@ public final strictfp class MilitaryGrid assertTrue(code, remaining.remove(code)); } assertTrue(remaining.toString(), remaining.isEmpty()); + /* + * Test parallel iteration using stream. + */ + assertTrue(remaining.addAll(expected)); + final Set<String> sync = Collections.synchronizedSet(remaining); + assertEquals("List of expected codes has duplicated values.", expected.size(), sync.size()); + coder.encode(areaOfInterest, true).forEach((code) -> assertTrue(code, sync.remove(code))); + assertTrue(sync.toString(), sync.isEmpty()); } } Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/geometry/CoordinateFormat.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/geometry/CoordinateFormat.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/geometry/CoordinateFormat.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/geometry/CoordinateFormat.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -53,7 +53,7 @@ import org.apache.sis.referencing.CRS; import org.apache.sis.io.CompoundFormat; // Branch-dependent imports -import org.apache.sis.internal.jdk8.UncheckedIOException; +import java.io.UncheckedIOException; /** Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/geometry/GeneralDirectPosition.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/geometry/GeneralDirectPosition.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/geometry/GeneralDirectPosition.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/geometry/GeneralDirectPosition.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -291,11 +291,9 @@ public class GeneralDirectPosition exten */ static Field getOrdinatesField(final Class<?> type) throws NoSuchFieldException { final Field field = type.getDeclaredField("ordinates"); - AccessController.doPrivileged(new PrivilegedAction<Void>() { - @Override public Void run() { - field.setAccessible(true); - return null; - } + AccessController.doPrivileged((PrivilegedAction<Void>) () -> { + field.setAccessible(true); + return null; }); return field; } Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_GeneralOperationParameter.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_GeneralOperationParameter.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_GeneralOperationParameter.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_GeneralOperationParameter.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -259,7 +259,7 @@ public final class CC_GeneralOperationPa * by the 'complete' descriptor. If the descriptor is a group, then this 'replacement' method will * be invoked recursively for each parameter in the group. */ - final Map<String,Object> merged = new HashMap<String,Object>(expected); + final Map<String,Object> merged = new HashMap<>(expected); merged.putAll(actual); // May overwrite pre-defined properties. mergeArrays(GeneralParameterDescriptor.ALIAS_KEY, GenericName.class, provided.getAlias(), merged, complete.getName()); mergeArrays(GeneralParameterDescriptor.IDENTIFIERS_KEY, ReferenceIdentifier.class, provided.getIdentifiers(), merged, null); Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/GeodeticObjectBuilder.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/GeodeticObjectBuilder.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/GeodeticObjectBuilder.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/GeodeticObjectBuilder.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -439,6 +439,6 @@ public class GeodeticObjectBuilder exten * Creates a map of properties containing only the name of the given object. */ private static Map<String,Object> name(final IdentifiedObject template) { - return Collections.<String,Object>singletonMap(IdentifiedObject.NAME_KEY, template.getName()); + return Collections.singletonMap(IdentifiedObject.NAME_KEY, template.getName()); } } Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/LazySet.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/LazySet.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/LazySet.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/LazySet.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -281,11 +281,6 @@ public class LazySet<E> extends SetOfUnk public E next() { return get(cursor++); } - - @Override - public void remove() { - throw new UnsupportedOperationException(); - } }; } } Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/MergedProperties.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/MergedProperties.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/MergedProperties.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/MergedProperties.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -69,7 +69,7 @@ public class MergedProperties extends Ab @Override protected EntryIterator<String,Object> entryIterator() { if (merge == null) { - merge = new HashMap<String,Object>(defaultProperties); + merge = new HashMap<>(defaultProperties); merge.putAll(properties); merge.remove(null); } Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -324,7 +324,7 @@ public final class ReferencingUtilities } name = CharSequences.trimWhitespaces(name, 0, i).toString(); if (!name.isEmpty()) { - final Map<String,Object> copy = new HashMap<String,Object>(properties); + final Map<String,Object> copy = new HashMap<>(properties); copy.put(IdentifiedObject.NAME_KEY, name); return copy; } Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -99,7 +99,6 @@ import org.apache.sis.util.Exceptions; import org.apache.sis.util.Utilities; // Branch-dependent imports -import org.apache.sis.internal.jdk8.JDK8; import org.apache.sis.metadata.iso.citation.DefaultCitation; import org.apache.sis.referencing.factory.GeodeticObjectFactory; import org.apache.sis.referencing.cs.DefaultParametricCS; @@ -765,9 +764,9 @@ public final class ServicesForMetadata e } properties = Collections.emptyMap(); } - final HashMap<String,Object> p = new HashMap<String,Object>(properties); - JDK8.putIfAbsent(p, CRS_FACTORY, crsFactory); - JDK8.putIfAbsent(p, CS_FACTORY, csFactory); + final HashMap<String,Object> p = new HashMap<>(properties); + p.putIfAbsent(CRS_FACTORY, crsFactory); + p.putIfAbsent(CS_FACTORY, csFactory); properties = p; return new DefaultCoordinateOperationFactory(properties, mtFactory); } Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/DatumShiftGridFile.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/DatumShiftGridFile.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/DatumShiftGridFile.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/DatumShiftGridFile.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -35,7 +35,6 @@ import org.apache.sis.referencing.operat import org.apache.sis.internal.referencing.j2d.AffineTransform2D; import org.apache.sis.internal.util.Utilities; -import org.apache.sis.internal.jdk8.JDK8; /** * A datum shift grid loaded from a file. @@ -366,7 +365,7 @@ public abstract class DatumShiftGridFile { super(coordinateUnit, translationUnit, isCellValueRatio, x0, y0, Δx, Δy, nx, ny, descriptor, files); offsets = new float[dim][]; - final int size = JDK8.multiplyExact(nx, ny); + final int size = Math.multiplyExact(nx, ny); for (int i=0; i<dim; i++) { Arrays.fill(offsets[i] = new float[size], java.lang.Float.NaN); } Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/FranceGeocentricInterpolation.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/FranceGeocentricInterpolation.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/FranceGeocentricInterpolation.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/FranceGeocentricInterpolation.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -27,6 +27,7 @@ import java.io.EOFException; import java.io.IOException; import java.nio.file.Path; import java.nio.file.Paths; +import java.nio.file.Files; import javax.xml.bind.annotation.XmlTransient; import javax.measure.quantity.Angle; import javax.measure.quantity.Length; @@ -56,9 +57,6 @@ import org.apache.sis.referencing.operat import static java.lang.Float.parseFloat; -// Branch-specific imports -import org.apache.sis.internal.jdk8.JDK8; - /** * The provider for <cite>"France geocentric interpolation"</cite> (ESPG:9655). @@ -331,7 +329,7 @@ public class FranceGeocentricInterpolati try { grid = handler.peek(); if (grid == null) { - try (BufferedReader in = JDK8.newBufferedReader(resolved)) { + try (BufferedReader in = Files.newBufferedReader(resolved)) { DatumShiftGridLoader.log(FranceGeocentricInterpolation.class, file); final DatumShiftGridFile.Float<Angle,Length> g = load(in, file); grid = DatumShiftGridCompressed.compress(g, averages, scale); @@ -413,8 +411,8 @@ public class FranceGeocentricInterpolati yf = gridGeometry[3]; Δx = gridGeometry[4]; Δy = gridGeometry[5]; - nx = JDK8.toIntExact(Math.round((xf - x0) / Δx + 1)); - ny = JDK8.toIntExact(Math.round((yf - y0) / Δy + 1)); + nx = Math.toIntExact(Math.round((xf - x0) / Δx + 1)); + ny = Math.toIntExact(Math.round((yf - y0) / Δy + 1)); grid = new DatumShiftGridFile.Float<>(3, Units.DEGREE, Units.METRE, false, x0, y0, Δx, Δy, nx, ny, PARAMETERS, file); @@ -462,8 +460,8 @@ public class FranceGeocentricInterpolati t.nextToken(); // Ignored final double x = Double.parseDouble(t.nextToken()); // Longitude in degrees final double y = Double.parseDouble(t.nextToken()); // Latitude in degrees - final int i = JDK8.toIntExact(Math.round((x - x0) / Δx)); // Column index - final int j = JDK8.toIntExact(Math.round((y - y0) / Δy)); // Row index + final int i = Math.toIntExact(Math.round((x - x0) / Δx)); // Column index + final int j = Math.toIntExact(Math.round((y - y0) / Δy)); // Row index if (i < 0 || i >= nx) { throw new FactoryException(Errors.format(Errors.Keys.ValueOutOfRange_4, "x", x, x0, xf)); } Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/NADCON.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/NADCON.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/NADCON.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/NADCON.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -231,11 +231,6 @@ public final class NADCON extends Abstra private static final String NADCON = "NADCON"; /** - * The size of data in the binary file, in bytes. - */ - private static final int DATA_SIZE = Float.SIZE / Byte.SIZE; - - /** * Longitude and latitude of of the first value in the first record, in degrees. */ private final float x0, y0; @@ -307,7 +302,7 @@ public final class NADCON extends Abstra throw unexpectedFormat(); } if (ascii == null) { - skip((nx + 1) * DATA_SIZE - buffer.position()); + skip((nx + 1) * Float.BYTES - buffer.position()); } } @@ -453,8 +448,8 @@ public final class NADCON extends Abstra * from the channel, but the channel will usually give us as many data as the buffer can contain. */ private void fillBuffer(final FloatBuffer fb) throws IOException { - buffer.position(fb.position() * DATA_SIZE).limit(fb.limit() * DATA_SIZE); - ensureBufferContains(DATA_SIZE); // Require at least one float, but usually get many. + buffer.position(fb.position() * Float.BYTES).limit(fb.limit() * Float.BYTES); + ensureBufferContains(Float.BYTES); // Require at least one float, but usually get many. syncView(fb); } @@ -463,10 +458,10 @@ public final class NADCON extends Abstra * than the underlying {@code ByteBuffer}, converted to units of {@code float} data type. */ private void syncView(final FloatBuffer fb) { - if ((buffer.position() % DATA_SIZE) != 0) { + if ((buffer.position() % Float.BYTES) != 0) { buffer.compact(); // For bytes alignment with FloatBuffer. } - fb.limit(buffer.limit() / DATA_SIZE).position(buffer.position() / DATA_SIZE); + fb.limit(buffer.limit() / Float.BYTES).position(buffer.position() / Float.BYTES); } } } Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/NTv2.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/NTv2.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/NTv2.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/NTv2.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -53,7 +53,6 @@ import org.apache.sis.util.resources.Err import org.apache.sis.util.resources.Messages; import org.apache.sis.measure.Units; -import org.apache.sis.internal.jdk8.JDK8; /** * The provider for <cite>"National Transformation version 2"</cite> (EPSG:9615). @@ -315,9 +314,9 @@ public final class NTv2 extends Abstract final double dy = (Double) get("LAT_INC"); final double dx = (Double) get("LONG_INC"); // Positive toward west. final Integer declared = (Integer) header.get("GS_COUNT"); - final int width = JDK8.toIntExact(Math.round((xmax - xmin) / dx + 1)); - final int height = JDK8.toIntExact(Math.round((ymax - ymin) / dy + 1)); - final int count = JDK8.multiplyExact(width, height); + final int width = Math.toIntExact(Math.round((xmax - xmin) / dx + 1)); + final int height = Math.toIntExact(Math.round((ymax - ymin) / dy + 1)); + final int count = Math.multiplyExact(width, height); if (declared != null && count != declared) { throw new FactoryException(Errors.format(Errors.Keys.UnexpectedValueInElement_2, "GS_COUNT", declared)); } @@ -334,7 +333,7 @@ public final class NTv2 extends Abstract @SuppressWarnings("MismatchedReadAndWriteOfArray") final float[] tx = grid.offsets[0]; @SuppressWarnings("MismatchedReadAndWriteOfArray") final float[] ty = grid.offsets[1]; for (int i=0; i<count; i++) { - ensureBufferContains(4 * (Float.SIZE / Byte.SIZE)); + ensureBufferContains(4 * Float.BYTES); ty[i] = (float) (buffer.getFloat() / dy); // Division by dx and dy because isCellValueRatio = true. tx[i] = (float) (buffer.getFloat() / dx); final double accuracy = Math.min(buffer.getFloat() / dy, buffer.getFloat() / dx); @@ -350,7 +349,7 @@ public final class NTv2 extends Abstract * Returns {@code true} if the given value seems to be stored in little endian order. */ private static boolean isLittleEndian(final int n) { - return JDK8.compareUnsigned(n, Integer.reverseBytes(n)) > 0; + return Integer.compareUnsigned(n, Integer.reverseBytes(n)) > 0; } /** Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/AbstractParameterDescriptor.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/AbstractParameterDescriptor.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/AbstractParameterDescriptor.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/AbstractParameterDescriptor.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -231,7 +231,7 @@ public abstract class AbstractParameterD */ @Override public int getMinimumOccurs() { - return minimumOccurs & 0xFFFF; + return Short.toUnsignedInt(minimumOccurs); } /** @@ -242,7 +242,7 @@ public abstract class AbstractParameterD */ @Override public int getMaximumOccurs() { - return (maximumOccurs != -1) ? (maximumOccurs & 0xFFFF) : Integer.MAX_VALUE; + return (maximumOccurs != -1) ? Short.toUnsignedInt(maximumOccurs) : Integer.MAX_VALUE; } /** Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/IntegerList.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/IntegerList.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/IntegerList.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/IntegerList.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -16,6 +16,7 @@ */ package org.apache.sis.parameter; +import java.util.StringJoiner; import java.lang.reflect.Array; import javax.xml.bind.annotation.XmlValue; import org.apache.sis.util.CharSequences; @@ -52,11 +53,10 @@ final class IntegerList { * @param array the integer values as a Java array. */ public IntegerList(final Object array) { - final StringBuilder builder = new StringBuilder(); + final StringJoiner builder = new StringJoiner(" "); final int length = Array.getLength(array); for (int i=0; i<length; i++) { - if (i != 0) builder.append(' '); - builder.append(Array.get(array, i)); + builder.add(String.valueOf(Array.get(array, i))); } value = builder.toString(); } Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterTableRow.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterTableRow.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterTableRow.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterTableRow.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -48,9 +48,6 @@ import static org.apache.sis.internal.ut import static org.apache.sis.util.CharSequences.spaces; import static org.apache.sis.util.iso.DefaultNameSpace.DEFAULT_SEPARATOR; -// Branch-dependent imports -import org.apache.sis.internal.jdk8.JDK8; - /** * A row in the table to be formatted by {@link ParameterFormat}. @@ -194,7 +191,7 @@ final class ParameterTableRow { final InternationalString r = object.getRemarks(); if (r != null) { final int n = remarks.size() + 1; - final Integer p = JDK8.putIfAbsent(remarks, r.toString(locale), n); + final Integer p = remarks.putIfAbsent(r.toString(locale), n); this.remarks = (p != null) ? p : n; } } Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/Parameters.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/Parameters.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/Parameters.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/Parameters.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -37,9 +37,6 @@ import org.apache.sis.util.ObjectConvert import org.apache.sis.util.resources.Errors; import org.apache.sis.util.Debug; -// Branch-dependent imports -import org.apache.sis.internal.jdk8.JDK8; - /** * Convenience methods for fetching parameter values despite the variations in parameter names, value types and units. @@ -769,7 +766,7 @@ public abstract class Parameters impleme final Map<String,Integer> occurrences = new HashMap<>(); for (final GeneralParameterValue value : values.values()) { final String name = value.getDescriptor().getName().getCode(); - final int occurrence = JDK8.getOrDefault(occurrences, name, ZERO); + final int occurrence = occurrences.getOrDefault(name, ZERO); if (value instanceof ParameterValueGroup) { /* * Contains sub-group - invokes 'copy' recursively. Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/TensorValues.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/TensorValues.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/TensorValues.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/TensorValues.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -176,7 +176,7 @@ final class TensorValues<E> extends Abst */ @Override public List<GeneralParameterDescriptor> descriptors() { - return UnmodifiableArrayList.<GeneralParameterDescriptor>wrap(descriptors.getAllDescriptors(size())); + return UnmodifiableArrayList.wrap(descriptors.getAllDescriptors(size())); } /** Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/UnmodifiableParameterValueGroup.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/UnmodifiableParameterValueGroup.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/UnmodifiableParameterValueGroup.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/UnmodifiableParameterValueGroup.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -106,7 +106,7 @@ final class UnmodifiableParameterValueGr if (group == null || group instanceof UnmodifiableParameterValueGroup) { return (UnmodifiableParameterValueGroup) group; } - return new UnmodifiableParameterValueGroup(group, new IdentityHashMap<ParameterValueGroup,Boolean>(4)); + return new UnmodifiableParameterValueGroup(group, new IdentityHashMap<>(4)); } /** Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/Builder.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/Builder.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/Builder.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/Builder.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -42,7 +42,6 @@ import org.apache.sis.util.resources.Err import static org.apache.sis.util.ArgumentChecks.*; // Branch-dependent imports -import org.apache.sis.internal.jdk8.JDK8; import org.opengis.referencing.ReferenceIdentifier; @@ -371,7 +370,7 @@ public abstract class Builder<B extends * @throws IllegalStateException if a new value is specified in a phase where the value can not be changed. */ private boolean setProperty(final String key, final Object value) throws IllegalStateException { - final Object previous = JDK8.putIfAbsent(properties, key, value); + final Object previous = properties.putIfAbsent(key, value); if (previous != null) { if (previous.equals(value)) { return false; @@ -509,7 +508,7 @@ public abstract class Builder<B extends ensureNonNull("name", name); if (isDeprecated()) { aliases.add(new DeprecatedName(getAuthority(), getCodeSpace(), name, getVersion(), getRemarks())); - } else if (JDK8.putIfAbsent(properties, IdentifiedObject.NAME_KEY, name.toString()) != null) { + } else if (properties.putIfAbsent(IdentifiedObject.NAME_KEY, name.toString()) != null) { // A primary name is already present. Add the given name as an alias instead. aliases.add(createName(name)); } @@ -590,7 +589,7 @@ public abstract class Builder<B extends */ public B addName(final ReferenceIdentifier name) { ensureNonNull("name", name); - if (JDK8.putIfAbsent(properties, IdentifiedObject.NAME_KEY, name) != null) { + if (properties.putIfAbsent(IdentifiedObject.NAME_KEY, name) != null) { // A primary name is already present. Add the given name as an alias instead. aliases.add(name instanceof GenericName ? (GenericName) name : new NamedIdentifier(name)); } Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -21,7 +21,6 @@ import java.util.List; import java.util.ArrayList; import java.util.Collections; import java.util.logging.LogRecord; -import javax.measure.Unit; import org.opengis.util.FactoryException; import org.opengis.geometry.Envelope; import org.opengis.referencing.NoSuchAuthorityCodeException; @@ -940,16 +939,6 @@ public final class CRS extends Static { @Override public boolean accept(final CoordinateSystemAxis axis) { return !AxisDirections.isVertical(axis.getDirection()); } - - @Override - public AxisDirection getDirectionReplacement(CoordinateSystemAxis axis, AxisDirection direction) { - return direction; - } - - @Override - public Unit<?> getUnitReplacement(CoordinateSystemAxis axis, Unit<?> unit) { - return unit; - } }); if (cs.getDimension() != 2) break; /* Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -82,9 +82,6 @@ import static java.util.Collections.sing import static org.opengis.referencing.IdentifiedObject.NAME_KEY; import static org.apache.sis.internal.util.StandardDateFormat.MILLISECONDS_PER_DAY; -// Branch-dependent imports -import org.apache.sis.internal.jdk8.JDK8; - /** * Frequently-used geodetic CRS and datum that are guaranteed to be available in SIS. @@ -1079,9 +1076,9 @@ public enum CommonCRS { */ int code = 0; if (!isUTM) { - code = (isSouth ? southUPS : northUPS) & 0xFFFF; + code = Short.toUnsignedInt(isSouth ? southUPS : northUPS); } else if (zone >= firstZone && zone <= lastZone) { - code = (isSouth ? southUTM : northUTM) & 0xFFFF; + code = Short.toUnsignedInt(isSouth ? southUTM : northUTM); } if (code != 0) { if (isUTM) code += zone; @@ -1128,7 +1125,7 @@ public enum CommonCRS { crs = StandardDefinitions.createUniversal(code, geographic(), isUTM, latitude, longitude, cs); final ProjectedCRS other; synchronized (cachedProjections) { - other = JDK8.putIfAbsent(cachedProjections, key, crs); + other = cachedProjections.putIfAbsent(key, crs); } if (other != null) { return other; @@ -1735,7 +1732,7 @@ public enum CommonCRS { * Returns the same properties than the given object, except for the identifier which is set to the given code. */ private static Map<String,?> properties(final IdentifiedObject template, final short code) { - final Map<String,Object> properties = new HashMap<String,Object>(IdentifiedObjects.getProperties(template, EXCLUDE)); + final Map<String,Object> properties = new HashMap<>(IdentifiedObjects.getProperties(template, EXCLUDE)); properties.put(GeographicCRS.IDENTIFIERS_KEY, new NamedIdentifier(Citations.EPSG, String.valueOf(code))); return properties; } Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/NameIterator.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/NameIterator.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/NameIterator.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/NameIterator.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -100,13 +100,10 @@ final class NameIterator implements Iter return n; } - /** - * Unsupported operation since this iterator is read-only. + /* + * remove() is an unsupported operation since this iterator is read-only. + * So we inherit the default implementation from Iterator. */ - @Override - public void remove() { - throw new UnsupportedOperationException(); - } /** * Returns the number of name and aliases in the given object. Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeographicCRS.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeographicCRS.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeographicCRS.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeographicCRS.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -262,7 +262,7 @@ public class DefaultGeographicCRS extend if (EPSG.equals(identifier.getCodeSpace())) try { final int i = Arrays.binarySearch(EPSG_CODES, Short.parseShort(identifier.getCode())); if (i >= 0) { - final Map<String,Object> c = new HashMap<String,Object>(properties); + final Map<String,Object> c = new HashMap<>(properties); c.put(IDENTIFIERS_KEY, new ImmutableIdentifier(Citations.WMS, CRS, Short.toString(CRS_CODES[i]))); properties = c; } Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -147,11 +147,6 @@ public enum AxesConvention implements Ax */ NORMALIZED { @Override - public boolean accept(final CoordinateSystemAxis axis) { - return true; - } - - @Override public Unit<?> getUnitReplacement(final CoordinateSystemAxis axis, Unit<?> unit) { if (Units.isLinear(unit)) { unit = Units.METRE; @@ -231,18 +226,7 @@ public enum AxesConvention implements Ax * @since 0.5 */ CONVENTIONALLY_ORIENTED { - @Override - public boolean accept(final CoordinateSystemAxis axis) { - return true; - } - - @Override - public Unit<?> getUnitReplacement(final CoordinateSystemAxis axis, final Unit<?> unit) { - return unit; - } - - @Override - public AxisDirection getDirectionReplacement(CoordinateSystemAxis axis, AxisDirection direction) { + @Override public AxisDirection getDirectionReplacement(CoordinateSystemAxis axis, AxisDirection direction) { return NORMALIZED.getDirectionReplacement(axis, direction); } }, @@ -274,22 +258,7 @@ public enum AxesConvention implements Ax * @see org.apache.sis.referencing.cs.CoordinateSystems#angle(AxisDirection, AxisDirection) * @see <a href="http://en.wikipedia.org/wiki/Right_hand_rule">Right-hand rule on Wikipedia</a> */ - RIGHT_HANDED { - @Override - public boolean accept(final CoordinateSystemAxis axis) { - return true; - } - - @Override - public Unit<?> getUnitReplacement(CoordinateSystemAxis axis, final Unit<?> unit) { - return unit; - } - - @Override - public AxisDirection getDirectionReplacement(CoordinateSystemAxis axis, final AxisDirection direction) { - return direction; - } - }, + RIGHT_HANDED, /** * Axes having a <cite>wraparound</cite> @@ -314,20 +283,5 @@ public enum AxesConvention implements Ax * * @see org.opengis.referencing.cs.RangeMeaning#WRAPAROUND */ - POSITIVE_RANGE { - @Override - public boolean accept(final CoordinateSystemAxis axis) { - return true; - } - - @Override - public Unit<?> getUnitReplacement(CoordinateSystemAxis axis, final Unit<?> unit) { - return unit; - } - - @Override - public AxisDirection getDirectionReplacement(CoordinateSystemAxis axis, final AxisDirection direction) { - return direction; - } - } + POSITIVE_RANGE } Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxisFilter.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxisFilter.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxisFilter.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxisFilter.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -36,6 +36,10 @@ import javax.measure.Unit; * For example excluding the <var>z</var> axis of a {@linkplain DefaultCylindricalCS cylindrical} coordinate system * results in a {@linkplain DefaultPolarCS polar} coordinate system.</p> * + * <div class="section">Default implementation</div> + * All methods in this interface have a default implementation equivalent to <i>no-operation</i>. + * Implementors need to override only the methods for the aspects to change. + * * <div class="section">Limitations</div> * This interface is not for changing axis order. * For changing axis order in addition to axis directions or units, see {@link AxesConvention}. @@ -51,14 +55,18 @@ import javax.measure.Unit; public interface AxisFilter { /** * Returns {@code true} if the given axis shall be included in the new coordinate system. + * The default implementation unconditionally returns {@code true}. * * @param axis the axis to test. * @return {@code true} if the given axis shall be included in the new coordinate system. */ - boolean accept(CoordinateSystemAxis axis); + default boolean accept(CoordinateSystemAxis axis) { + return true; + } /** * Returns a replacement for the given axis direction. + * The default implementation unconditionally returns the given {@code direction} unchanged. * * <div class="note"><b>Example:</b> * for forcing the direction of the <var>z</var> axis toward up while leaving other axes unchanged, @@ -81,10 +89,13 @@ public interface AxisFilter { * * @since 0.7 */ - AxisDirection getDirectionReplacement(CoordinateSystemAxis axis, AxisDirection direction); + default AxisDirection getDirectionReplacement(CoordinateSystemAxis axis, AxisDirection direction) { + return direction; + } /** * Returns a replacement for the given axis unit. + * The default implementation unconditionally returns the given {@code unit} unchanged. * * <div class="note"><b>Example:</b> * for replacing all angular units of a coordinate system to degrees (regardless what the original @@ -107,5 +118,7 @@ public interface AxisFilter { * * @since 0.7 */ - Unit<?> getUnitReplacement(CoordinateSystemAxis axis, Unit<?> unit); + default Unit<?> getUnitReplacement(CoordinateSystemAxis axis, Unit<?> unit) { + return unit; + } } Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Codes.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Codes.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Codes.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Codes.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -75,7 +75,7 @@ final class Codes { private static int pack(final AxisDirection[] directions) { int packed = 0; int i = directions.length; - if (i <= Integer.SIZE / Byte.SIZE) { + if (i <= Integer.BYTES) { while (--i >= 0) { final int ordinal = directions[i].ordinal(); if (ordinal <= 0 || ordinal > Byte.MAX_VALUE) { Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -430,16 +430,6 @@ public final class CoordinateSystems ext @Override public Unit<?> getUnitReplacement(CoordinateSystemAxis axis, Unit<?> unit) { return Units.isLinear(unit) ? newUnit : unit; } - - @Override - public boolean accept(CoordinateSystemAxis axis) { - return true; - } - - @Override - public AxisDirection getDirectionReplacement(CoordinateSystemAxis axis, AxisDirection direction) { - return direction; - } }); } @@ -471,16 +461,6 @@ public final class CoordinateSystems ext @Override public Unit<?> getUnitReplacement(CoordinateSystemAxis axis, Unit<?> unit) { return Units.isAngular(unit) ? newUnit : unit; } - - @Override - public boolean accept(CoordinateSystemAxis axis) { - return true; - } - - @Override - public AxisDirection getDirectionReplacement(CoordinateSystemAxis axis, AxisDirection direction) { - return direction; - } }); } Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -63,9 +63,6 @@ import org.apache.sis.util.logging.Perfo import org.apache.sis.util.resources.Errors; import org.apache.sis.util.resources.Messages; -// Branch-dependent imports -import org.apache.sis.internal.jdk8.JDK8; - /** * A concurrent authority factory that caches all objects created by another factory. @@ -1878,7 +1875,7 @@ public abstract class ConcurrentAuthorit result = CollectionsExt.unmodifiableOrCopy(result); FindEntry entry = new FindEntry(); synchronized (findPool) { - final FindEntry c = JDK8.putIfAbsent(findPool, object, entry); + final FindEntry c = findPool.putIfAbsent(object, entry); if (c != null) { entry = c; // May happen if the same set has been computed in another thread. } Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -144,7 +144,7 @@ public abstract class GeodeticAuthorityF */ public Set<String> getCodeSpaces() { final String authority = org.apache.sis.metadata.iso.citation.Citations.getCodeSpace(getAuthority()); - return (authority != null) ? Collections.singleton(authority) : Collections.<String>emptySet(); + return (authority != null) ? Collections.singleton(authority) : Collections.emptySet(); } /** Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -1656,11 +1656,9 @@ public class GeodeticObjectFactory exten c = Class.forName("org.apache.sis.io.wkt.GeodeticObjectParser").asSubclass(Parser.class) .getConstructor(Map.class, ObjectFactory.class, MathTransformFactory.class); final Constructor<?> cp = c; // For allowing use in inner class or lambda expression. - AccessController.doPrivileged(new PrivilegedAction<Void>() { - @Override public Void run() { - cp.setAccessible(true); - return null; - } + AccessController.doPrivileged((PrivilegedAction<Void>) () -> { + cp.setAccessible(true); + return null; }); parserConstructor = c; } Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/IdentifiedObjectSet.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/IdentifiedObjectSet.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/IdentifiedObjectSet.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/IdentifiedObjectSet.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -44,7 +44,6 @@ import org.apache.sis.util.ArgumentCheck import org.apache.sis.util.Localized; import org.apache.sis.util.Classes; -import org.apache.sis.internal.jdk8.JDK8; /** * A lazy set of {@code IdentifiedObject} instances created from their authority codes only when first needed. @@ -244,7 +243,7 @@ public class IdentifiedObjectSet<T exten */ public void addAuthorityCode(final String code) { synchronized (objects) { - if (JDK8.putIfAbsent(objects, code, null) == null) { + if (objects.putIfAbsent(code, null) == null) { codes = null; } } @@ -317,12 +316,12 @@ public class IdentifiedObjectSet<T exten * has been invoked before the concurrent removal happened. */ if (objects.containsKey(code)) { // Needed because code may be associated to null value. - final T c = JDK8.putIfAbsent(objects, code, object); + final T c = objects.putIfAbsent(code, object); if (c != null) { object = c; // The object has been created concurrently. } } - } else if (JDK8.remove(objects, code, null)) { // Do not remove if a concurrent thread succeeded. + } else if (objects.remove(code, null)) { // Do not remove if a concurrent thread succeeded. codes = null; } } Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/MultiAuthoritiesFactory.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/MultiAuthoritiesFactory.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/MultiAuthoritiesFactory.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/MultiAuthoritiesFactory.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -65,9 +65,6 @@ import org.apache.sis.util.resources.Err import org.apache.sis.util.iso.DefaultNameSpace; import org.apache.sis.util.collection.BackingStoreException; -// Branch-dependent imports -import org.apache.sis.internal.jdk8.JDK8; - /** * A factory that delegates the object creation to another factory determined from the <var>authority</var> part @@ -523,7 +520,7 @@ public class MultiAuthoritiesFactory ext return ((GeodeticAuthorityFactory) factory).getCodeSpaces(); } else { final String authority = Citations.getCodeSpace(factory.getAuthority()); - return (authority != null) ? Collections.singleton(authority) : Collections.<String>emptySet(); + return (authority != null) ? Collections.singleton(authority) : Collections.emptySet(); } } @@ -546,7 +543,7 @@ public class MultiAuthoritiesFactory ext * @return the given {@code factory} if no previous instance was cached, or the existing instance otherwise. */ private AuthorityFactory cache(final AuthorityFactoryIdentifier identifier, final AuthorityFactory factory) { - final AuthorityFactory existing = JDK8.putIfAbsent(factories, identifier.intern(), factory); + final AuthorityFactory existing = factories.putIfAbsent(identifier.intern(), factory); return (existing != null) ? existing : factory; } @@ -746,7 +743,7 @@ public class MultiAuthoritiesFactory ext return false; } // Invoke identifier.intern() only if needed. - return JDK8.putIfAbsent(warnings, identifier.intern(), Boolean.TRUE) == null; + return warnings.putIfAbsent(identifier.intern(), Boolean.TRUE) == null; } } Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -123,7 +123,6 @@ import static org.apache.sis.internal.ut import static org.apache.sis.internal.referencing.ServicesForMetadata.CONNECTION; // Branch-dependent imports -import org.apache.sis.internal.jdk8.JDK8; import org.apache.sis.internal.util.StandardDateFormat; import org.apache.sis.referencing.cs.DefaultParametricCS; import org.apache.sis.referencing.datum.DefaultParametricDatum; @@ -969,7 +968,7 @@ addURIs: for (int i=0; ; i++) { * } */ private void ensureNoCycle(final Class<?> type, final Integer code) throws FactoryException { - if (JDK8.putIfAbsent(safetyGuard, code, type) != null) { + if (safetyGuard.putIfAbsent(code, type) != null) { throw new FactoryException(resources().getString(Resources.Keys.RecursiveCreateCallForCode_2, type, code)); } } @@ -1357,7 +1356,7 @@ addURIs: for (int i=0; ; i++) { case "geographic 3d": { Integer csCode = getInteger(code, result, 8); if (replaceDeprecatedCS) { - csCode = JDK8.getOrDefault(DEPRECATED_CS, csCode, csCode); + csCode = DEPRECATED_CS.getOrDefault(csCode, csCode); } final EllipsoidalCS cs = owner.createEllipsoidalCS(csCode.toString()); final String datumCode = getOptionalString(result, 9); @@ -3116,7 +3115,7 @@ next: while (r.next()) { from = "Ellipsoid"; where = "SEMI_MAJOR_AXIS"; table = TableInfo.ELLIPSOID; - codes = Collections.<Number>singleton(((Ellipsoid) object).getSemiMajorAxis()); + codes = Collections.singleton(((Ellipsoid) object).getSemiMajorAxis()); isFloat = true; } else { final IdentifiedObject dependency; Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGInstaller.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGInstaller.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGInstaller.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGInstaller.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -39,9 +39,6 @@ import org.apache.sis.setup.Installation import static org.apache.sis.internal.util.Constants.EPSG; -// Branch-dependent imports -import org.apache.sis.internal.jdk8.BiFunction; - /** * Runs the SQL scripts for creating an EPSG database. @@ -173,19 +170,17 @@ final class EPSGInstaller extends Script * Prepends the given schema or catalog to all table names. */ final void prependNamespace(final String schema) { - modifyReplacements(new BiFunction<String,String,String>() { - @Override public String apply(String key, String value) { - if (key.startsWith(SQLTranslator.TABLE_PREFIX)) { - final StringBuilder buffer = new StringBuilder(value.length() + schema.length() + 5); - buffer.append(identifierQuote).append(schema).append(identifierQuote).append('.'); - final boolean isQuoted = value.endsWith(identifierQuote); - if (!isQuoted) buffer.append(identifierQuote); - buffer.append(value); - if (!isQuoted) buffer.append(identifierQuote); - value = buffer.toString(); - } - return value; + modifyReplacements((key, value) -> { + if (key.startsWith(SQLTranslator.TABLE_PREFIX)) { + final StringBuilder buffer = new StringBuilder(value.length() + schema.length() + 5); + buffer.append(identifierQuote).append(schema).append(identifierQuote).append('.'); + final boolean isQuoted = value.endsWith(identifierQuote); + if (!isQuoted) buffer.append(identifierQuote); + buffer.append(value); + if (!isQuoted) buffer.append(identifierQuote); + value = buffer.toString(); } + return value; }); } Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/InstallationScriptProvider.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/InstallationScriptProvider.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/InstallationScriptProvider.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/InstallationScriptProvider.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -366,7 +366,7 @@ public abstract class InstallationScript */ @Override public Set<String> getAuthorities() { - return (directory != null) ? super.getAuthorities() : Collections.<String>emptySet(); + return (directory != null) ? super.getAuthorities() : Collections.emptySet(); } /**