<Swing Dev> Integrated: 8271456: Avoid looking up standard charsets in "java.desktop" module
Sergey Bylokhov
serb at openjdk.java.net
Wed Aug 4 18:48:32 UTC 2021
On Sun, 1 Aug 2021 07:07:21 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:
> This is a request to clean up a desktop module as was done in JDK-8233884 for "java.base" module.
>
> In many places standard charsets are looked up via their names, for example:
> absolutePath.getBytes("UTF-8");
>
> This could be done more efficiently(x20 time faster) with use of java.nio.charset.StandardCharsets:
> absolutePath.getBytes(StandardCharsets.UTF_8);
>
> The later variant also makes the code cleaner, as it is known not to throw UnsupportedEncodingException in contrary to the former variant.
>
> Tested by the desktop headless/headful tests on linux/windows.
This pull request has now been integrated.
Changeset: 6b55ef3b
Author: Sergey Bylokhov <serb at openjdk.org>
URL: https://git.openjdk.java.net/jdk/commit/6b55ef3b58ae405c46f440e06b5adb03cec3a500
Stats: 761 lines in 33 files changed: 337 ins; 269 del; 155 mod
8271456: Avoid looking up standard charsets in "java.desktop" module
Reviewed-by: jdv, azvegint, aivanov
-------------
PR: https://git.openjdk.java.net/jdk/pull/4951
More information about the swing-dev
mailing list