On Tue, 6 Dec 2022 07:08:55 GMT, Jaikiran Pai <j...@openjdk.org> wrote:
> Furthermore, I think in its current form it means that this will > load/instantiate any `JdkConsoleProvider` implementations that are accessible > to the thread context classloader but may not have been from the module > configured through `jdk.console` system property. That could potentially > mean, in the best case, unnecessary classloading of additional classes and in > the worst case, could result in `ServiceLoader.Provider::get` throwing a > `ServiceConfigurationError` error for any of such unused provider > implementations, thus forcing us to use `java.io.Console` instance. You are right that the ServiceLoader.load should specify the system class loader or the boot layer. However, there isn't an accessibility issue as a class loader just load classes so it's more about visibility and whether the TCCL will ultimately delegate to the application class loader. ------------- PR: https://git.openjdk.org/jdk/pull/11421