On Tue, 3 Aug 2021 19:37:04 GMT, Sergey Bylokhov <[email protected]> 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.
>
> Sergey Bylokhov has updated the pull request with a new target base due to a
> merge or a rebase. The incremental webrev excludes the unrelated changes
> brought in by the merge/rebase. The pull request contains two additional
> commits since the last revision:
>
> - Merge branch 'master' into JDK-8271456
> - Initial fix for JDK-8271456
Marked as reviewed by aivanov (Reviewer).
src/java.desktop/windows/classes/sun/awt/windows/WDataTransferer.java line 270:
> 268: charset = new String((byte[])localeTransferable.
> 269: getTransferData(javaTextEncodingFlavor),
> 270: StandardCharsets.UTF_8);
Suggestion:
getTransferData(javaTextEncodingFlavor),
StandardCharsets.UTF_8);
The parameter on the second line should probably be aligned with the first
parameter as it's done in the snippet above.
-------------
PR: https://git.openjdk.java.net/jdk/pull/4951