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

Alexey Ivanov aivanov at openjdk.java.net
Tue Aug 3 21:57:31 UTC 2021


On Tue, 3 Aug 2021 21:39:14 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

>> 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.
>
> it is aligned already, the StandardCharsets.UTF_8 is parameter of "new String()", not the getTransferData.

Ah, right!
But it's confusing: it looks as if `StandardCharsets.UTF_8` is a parameter to `getTransferData`. Maybe avoid breaking the line and leave `UTF_8`  on the same line? If you import `UTF_8` and `UTF_16LE` statically, line break is unnecessary.

-------------

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


More information about the 2d-dev mailing list