RFR 8234147 : Avoid looking up standard charsets in core libraries
Alan.Bateman at oracle.com
Sun Dec 1 19:10:45 UTC 2019
On 01/12/2019 08:44, Ivan Gerasimov wrote:
> Personally, I think that using constants sun.nio.cs.xxx.INSTANCE is
> not too bad even in the code that is unlikely to be executed during
> the VM startup. One small advantage is that if the code is
> copy/pasted within the java.base module, it will not bring the risk of
> early initialization of StandardCharsets.
> With NTLM, however, switching to StandardCharsets allows to remove
> sun.nio.cs.UTF_16LE.INSTANCE and all other corresponding modifications.
> So, I used StandardCharsets in NTLM (and in XML and SOCKS, as you
> suggested), and left sun.nio.cs constants in all other places.
> Here's the updated webrev:
> It builds fine, tests run fine.
Okay although my personal view is that a lot of this is unnecessary,
e.g. the pack200 Driver class, IllegalAccessMap is not used at run-time
with images builds, the InetAddress hosts file requires a special
property to enable, and several others. On the other hand, there are
several places where the handling of UnsupportedEncodingException goes
away so those parts are good.
More information about the core-libs-dev