RFR: 8359119: Change Charset to use StableValue [v2]

Shaojin Wen swen at openjdk.org
Sun Jul 20 22:17:47 UTC 2025


On Tue, 10 Jun 2025 15:15:44 GMT, Per Minborg <pminborg at openjdk.org> wrote:

>> Fields and methods can better leverage the Stable Value API compared to using DCL and holder classes. There are also some fields that can be marked `@Stable`.
>> 
>> This PR passes tier1, tier2, and tier3 tests on multiple platforms.
>
> Per Minborg has updated the pull request incrementally with three additional commits since the last revision:
> 
>  - Revert for loop
>  - Revert more
>  - Revert changes

After this proposal, the startup will load 9 more classes

* Java Code

public class Startup {
    public static void main(String[] args) throws Exception {
        Thread.sleep(1000);
    }
}



./build/macosx-aarch64-server-release/images/jdk/bin/java -verbose:class Startup


By comparing the output before and after this proposal, we can see that 9 more classes are loaded, as follows:

[info][class,load] java.nio.charset.Charset$2
[info][class,load] java.lang.StableValue
[info][class,load] java.util.Objects
[info][class,load] jdk.internal.lang.stable.StableSupplier
[info][class,load] jdk.internal.lang.stable.StableValueImpl
[info][class,load] java.nio.charset.Charset$3
[info][class,load] java.nio.charset.Charset$4
[info][class,load] java.nio.charset.Charset$5
[info][class,load] jdk.internal.ref.Cleaner

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

PR Comment: https://git.openjdk.org/jdk/pull/25727#issuecomment-3094824883


More information about the nio-dev mailing list