Use java.util.ServiceLoader instead of javax.imageio.spi.ServiceRegistry

Description

GeoTools does not work with Java 9 (build 80 and later) because a change of behavior introduced in JDK-8068749:
https://bugs.openjdk.java.net/browse/JDK-8068749

The future release notes of Java 9 will mention:
Java SE has been changed so that javax.imageio.spi.ServiceRegistry no longer allows service providers of other than Image I/O service types to be loaded. This is a behavioral change. Existing application binaries that attempt to use ServiceRegistry for non-Image-I/O services will cause IllegalArgumentException to be thrown at runtime. Such applications should be migrated to use java.util.ServiceLoader instead of javax.imageio.spi.ServiceRegistry.

The class org.geotools.factory.FactoryRegistry must be rewritten to not rely anymore on javax.imageio.spi.ServiceRegistry.

Initializing GeoTools with Java 9 in our application, JOSM, currently leads to the following exception:

Environment

Java 9 Early Access, build 81:

java version "1.9.0-ea"
Java(TM) SE Runtime Environment (build 1.9.0-ea-b81)
Java HotSpot(TM) 64-Bit Server VM (build 1.9.0-ea-b81, mixed mode)

Status

Assignee

Jody Garnett

Reporter

Vincent Privat

Triage

None

Components

Fix versions

Affects versions

Priority

Highest
Configure