--- old/src/java.base/share/classes/java/util/ServiceLoader.java 2017-02-07 13:13:38.132567438 +0000 +++ new/src/java.base/share/classes/java/util/ServiceLoader.java 2017-02-07 13:13:37.962555763 +0000 @@ -119,7 +119,7 @@ * and deployed as an explicit module must have an appropriate uses * clause in its module descriptor to declare that the module uses * implementations of the service. A corresponding requirement is that a - * provider deployed as a named module must have an appropriate + * provider deployed as an explicit module must have an appropriate * provides clause in its module descriptor to declare that the module * provides an implementation of the service. The uses and * provides allow consumers of a service to be linked to modules @@ -203,8 +203,11 @@ * ordering of modules in a layer, is not defined. * *
If this loader's provider caches are cleared by invoking the {@link - * #reload() reload} method then existing streams for this service - * loader should be discarded.
+ * #reload() reload} method then existing streams for this service loader + * should be discarded. The returned stream's source {@code Spliterator} is + * fail-fast and will throw {@link ConcurrentModificationException} + * if the provider cache has been cleared. * * The following examples demonstrate usage. The first example
* creates a stream of providers, the second example is the same except
@@ -1300,6 +1313,7 @@
* @return A stream that lazily loads providers for this loader's service
*
* @since 9
+ * @spec JPMS
*/
public Stream ServiceLoader load(Class service,
@@ -1457,6 +1474,9 @@
* if the service type is not accessible to the caller or the
* caller is in an explicit module and its module descriptor does
* not declare that it uses {@code service}
+ *
+ * @revised 9
+ * @spec JPMS
*/
@CallerSensitive
public static ServiceLoader load(Class service) {
@@ -1490,6 +1510,9 @@
* if the service type is not accessible to the caller or the
* caller is in an explicit module and its module descriptor does
* not declare that it uses {@code service}
+ *
+ * @revised 9
+ * @spec JPMS
*/
@CallerSensitive
public static ServiceLoader loadInstalled(Class service) {
@@ -1522,6 +1545,7 @@
* not declare that it uses {@code service}
*
* @since 9
+ * @spec JPMS
*/
@CallerSensitive
public static ServiceLoader load(Layer layer, Class service) {
@@ -1551,6 +1575,7 @@
* or error is thrown when locating or instantiating the provider.
*
* @since 9
+ * @spec JPMS
*/
public Optional findFirst() {
Iterator iterator = iterator();