RFR [10]: 8186517: sun.nio.cs.StandardCharsets$Aliases and ClassMap can be lazily loaded

Peter Levart peter.levart at gmail.com
Thu Aug 24 16:35:37 UTC 2017

On 08/24/2017 12:13 AM, Claes Redestad wrote:
> On 2017-08-23 23:21, Xueming Shen wrote:
>> On 8/23/17, 8:48 AM, Claes Redestad wrote:
>>> On 08/23/2017 04:52 PM, Claes Redestad wrote:
>>>> We still need to key on the lower-case name in the cache for now:
>>> Or perhaps not. Since we're always loading these three Charset on
>>> bootstrap now, we might as well initialize them eagerly and bypass
>>> the cache entirely (but keep this neatly contained in StandardCharset).
>>> This allows us to lazily load the $Cache class too, further reducing
>>> work done during System.initPhase1:
>>> http://cr.openjdk.java.net/~redestad/8186517/jdk.02/
>> if we go that far :-) shouldn't we simply expose the 
>> utf8/8859-1/ascii charset
>> instance directly?
> Why not. If we went as far as to putting them in 
> java.nio.charset.Charset instead,
> we'd not even load sun...StandardCharsets during typical bootstrap, 
> which would
> of course make things even better for startup.

Hm... What about aliases? Would you hard-code them in the individual 
Charset classes (UTF_8, US_ASCII, ISO_8859_1)? They are currently 
generated in the body of sun...StandardCharsets.

Regards, Peter

More information about the nio-dev mailing list