[10] RFR: 8184665: Skip name and alias checks for standard Charsets

Claes Redestad claes.redestad at oracle.com
Tue Jul 18 14:16:48 UTC 2017

Hi Sherman,

On 07/14/2017 07:42 PM, Xueming Shen wrote:
> Hi Claes,
> The change looks fine.
> The only concern is that, in theory, it appears we no longer have any 
> "check"
> to guarantee that all "alias" names defined for these 3 charsets 
> indeed follow
> the spec? The consequence of this is that someone can obtain the alias 
> name
> from the specific "charset", and then that name will fail for 
> Charset.forName().
> I doubt we currently have a regression test to catch this.
> The possibility that we are going to add a new alias for these 3 is 
> low, but either
> a regress test (if we don't have one already) or a comment at
>  jdk/make/data/charsetmapping/charsets
> (for each of the def, to remind a possible change) might help to 
> prevent this
> from happening?

added regression sanity test, and reverted to use identity checks as 
elsewhere (if we are to clean this up to use equals everywhere,
better do it consistently throughout the code and ensure this works as
expected with no performance loss):


> -Sherman
> PS: The next step is to remove these 3 from the 
> sun.nio.cs.StandardCharsets? :-)

The static initializer for sun.nio.cs.StandardCharsets is loading a 
bunch of Strings
into the string table but only executes around 1.5k bytecode, so 
splitting these
always-loaded Charsets out might be a small footprint gain, but a very 
tiny startup
win at best.


More information about the core-libs-dev mailing list