Hi,

Please review the following change:

Bug: https://bugs.openjdk.java.net/browse/JDK-8187222
Webrev: http://cr.openjdk.java.net/~bchristi/8187222/webrev.00/

The method description of ClassLoader.getSystemClassLoader() states (in regards to setting a custom system classloader):

"If circular initialization of the system class loader is detected then an unspecified error or exception is thrown."

This ambiguity in the method description can and should be removed.

The method also has a @throws tag:

* @throws  IllegalStateException
*          If invoked recursively during the construction of the class
*          loader specified by the "{@code java.system.class.loader}"
*          property.

JDK 8 threw an IllegalStateException. This changed to an InternalError in 9b111[1].

Throwing an IllegalStateException conforms to the @throws tag, and returns to the previous behavior of JDK 8 and (earlier on in) 9. Also, as Alan points out in the bug, an InternalError looks like a bug in the JDK itself, whereas IllegalStateException better reflects that the issue likely lies in the custom classloader.

Automated build & test job passes cleanly.

Thanks,
-Brent

1. https://bugs.openjdk.java.net/browse/JDK-8142968

Reply via email to