[OpenJDK 2D-Dev] RFR: 8271456: Avoid looking up standard charsets in "java.desktop" module

Sergey Bylokhov serb at openjdk.java.net
Tue Aug 3 17:05:30 UTC 2021

On Tue, 3 Aug 2021 13:30:28 GMT, Alexander Zvegintsev <azvegint 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.
> src/java.desktop/share/classes/com/sun/imageio/plugins/wbmp/WBMPMetadata.java line 25:
>> 23:  * questions.
>> 24:  */
>> 25: 
> Since you updating a copyright year in all other files, you probably might want to update in this file too.

I did not update it since this is the only file where the imports are updated only(the UnsupportedEncodingException is removed).


PR: https://git.openjdk.java.net/jdk/pull/4951

More information about the 2d-dev mailing list