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

Claes Redestad claes.redestad at oracle.com
Thu Aug 24 20:00:57 UTC 2017

On 2017-08-24 20:06, Claes Redestad wrote:
>>> 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
>> ...perhaps the generator could be modified to generate a static 
>> method per charset, returning an array of aliases  instead of a 
>> static final field. StandardCharsets would become very light then as 
>> its <clinit> would not do much.
> Right, I was looking at it from a different angle (generate them 
> directly into each corresponding class), but this way is actually much 
> easier and should be easy enough to roll into this patch.



Manually verified that generated charsets look correct and ran all 
charset tests without issue.

> Should be a nice reduction in retained objects on minimal apps.

425 fewer objects allocated, -16.5Kb.


More information about the nio-dev mailing list