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

Xueming Shen xueming.shen at oracle.com
Fri Jul 14 17:42:21 UTC 2017

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


(for each of the def, to remind a possible change) might help to prevent this
from happening?


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

On 07/14/2017 10:03 AM, Claes Redestad wrote:
> Hi Roger,
> On 2017-07-14 18:25, Roger Riggs wrote:
>> Hi Claes,
>> Using == with references always looks a bit suspicious in the source code, especially strings.
>> Since the first thing in equals() is the identity check, I'd suggest using .equals for the comparisons.
> Sure, there's no significant performance difference, even in interpreted mode:
> http://cr.openjdk.java.net/~redestad/8184665/jdk.01/
> /Claes

More information about the core-libs-dev mailing list