RFR: 8359119: Change Charset to use StableValue

Alan Bateman alanb at openjdk.org
Tue Jun 10 14:35:30 UTC 2025


On Tue, 10 Jun 2025 14:11:47 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.
>
> src/java.base/share/classes/java/nio/charset/Charset.java line 683:
> 
>> 681:         }
>> 682:         this.name = canonicalName;
>> 683:         this.aliasSet = Set.of(as);
> 
> Creating an unmodifiable set is probably more efficient than storing an array and then lazily creating a set. Better to do a set directly up front.

I think the drive-by changes to this and to aliases, should be dropped, as they are a separate discussion.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25727#discussion_r2138066685


More information about the nio-dev mailing list