RFR: 8300916: Re-examine the initialization of JNU Charset in StaticProperty [v4]
Alan Bateman
alanb at openjdk.org
Thu Jan 26 08:59:43 UTC 2023
On Thu, 26 Jan 2023 02:37:57 GMT, Ichiroh Takiguchi <itakiguchi at 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
More information about the core-libs-dev
mailing list