On Thu, 26 Jan 2023 02:37:57 GMT, Ichiroh Takiguchi <itakigu...@openjdk.org> 
wrote:

> Could you explain about fragile scenario ?

Charset.defaultCharset does the lookup on the first usage. Since JDK 18, that 
first usage is in initPhase1 so it will always find the default charset in 
java.base. In JDK 9-17, the first usage may have been in initPhase2 (during 
module system initialization), in which case it would locate the default 
charset in java.base, the first usage may have been after the VM is fully 
initialized, in which case it would be a service provider lookup and maybe find 
it in jdk.charsets or on the class path.

I've added a comment to the [CSR](https://bugs.openjdk.org/browse/JDK-8301114) 
with more context and to support the proposal to double down on requiring the 
default charset to be in java.base.

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

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

Reply via email to