Integrated: 8335896: Source launcher should set TCCL

Christian Stein cstein at openjdk.org
Sun Jul 21 08:51:40 UTC 2024


On Tue, 9 Jul 2024 10:52:46 GMT, Christian Stein <cstein at openjdk.org> wrote:

> Please review this change to set the context class loader of the current thread to the in-memory class loader when the `java` launcher is invoked in source mode. Having the source launcher set the TCCL to the in-memory classloader is benefical for scenarious depending on the TCCL being set to the application-loading loader.
> 
> For example, the single-argument taking [`ServiceLoader.load(Class)`](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/ServiceLoader.html#load(java.lang.Class)) method creates "a new service loader for the given service type, using the current thread's [context class loader](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/Thread.html#getContextClassLoader())."

This pull request has now been integrated.

Changeset: ad498f57
Author:    Christian Stein <cstein at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/ad498f57fcead174306c6e6e3b2d1f9916821b84
Stats:     27 lines in 3 files changed: 23 ins; 2 del; 2 mod

8335896: Source launcher should set TCCL

Reviewed-by: alanb

-------------

PR: https://git.openjdk.org/jdk/pull/20097


More information about the compiler-dev mailing list