RFR: 8276849: Refresh the window icon on graphics configuration changes [v3]
Emmanuel Bourg
duke at openjdk.java.net
Tue Feb 22 22:47:54 UTC 2022
On Mon, 21 Feb 2022 13:00:03 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:
>> test/jdk/java/awt/Window/WindowIconUpdateOnDPIChanging/WindowIconUpdateOnDPIChangingTest.java line 98:
>>
>>> 96: frame.getContentPane().add(createInstrumentsPane(), BorderLayout.CENTER);
>>> 97: frame.getContentPane().add(createControlPanel(), BorderLayout.SOUTH);
>>> 98: frame.setIconImages(IntStream.rangeClosed(16, 32).mapToObj(size -> createIcon(size)).toList());
>>
>> In fact, I liked the version with method reference better even though the line is longer.
>>
>> But I still suggest wrapping the line at each dot to make it clearer what operations are performed on the stream.
>> Suggestion:
>>
>> frame.setIconImages(IntStream.rangeClosed(16, 32)
>> .mapToObj(size -> createIcon(size))
>> .toList());
>>
>> It fits into 80 column limit. If it's replaced with method reference as it was before, it doesn't fit but I don't see it as big problem.
>>
>> Alternatively, you can wrap the start of the stream too:
>> Suggestion:
>>
>> frame.setIconImages(
>> IntStream.rangeClosed(16, 32)
>> .mapToObj(WindowIconUpdateOnDPIChangingTest::createIcon)
>> .toList());
>>
>> The line with method reference takes 82 columns, I'm sure it's acceptable.
>
> Here, on GitHub the lines in the suggestion could be wrapped, the idea is that the dots `.` of the following method calls remain aligned.
Looks like excessive wrapping to me for a very simple and quite readable one-liner.
-------------
PR: https://git.openjdk.java.net/jdk/pull/6180
More information about the client-libs-dev
mailing list