Reviewer and committer request for 7198496
david.holmes at oracle.com
Wed Oct 3 13:17:40 UTC 2012
On 3/10/2012 10:50 PM, Paul Sandoz wrote:
> For the benefit of others; for some context see this recent thread:
> Basically ServiceLoader is treating a null CL parameter as the system CL for loading the META-INF/services resources file and as the bootstrap CL for loading the classes of class names declared in those resource files.
> Which also means that calls to:
> ServiceLoader.load(serviceInterface, Thread.currentThread().getContextClassLoader());
> Will behave oddly if the TCCL is null, from the JavaDoc of Thread.getContextClassLoader():
> the context ClassLoader for this Thread, or null indicating the system class loader (or, failing that, the bootstrap class loader)
The @return doc for getContextClassLoader is wrong, or at best
mis-leading. A null return does NOT indicate the system class loader
(which is never null) - it simply means there is no CCL for that thread.
If anything null would represent the bootstrap loader.
More information about the core-libs-dev