<i18n dev> RFR: 8274640: Cleanup unnecessary null comparison before instanceof check in java.desktop [v2]
Alexey Ivanov
aivanov at openjdk.java.net
Mon Nov 29 11:23:12 UTC 2021
On Mon, 29 Nov 2021 08:01:56 GMT, Andrey Turbanov <duke at openjdk.java.net> wrote:
>> src/java.desktop/macosx/classes/com/apple/laf/AquaRootPaneUI.java line 78:
>>
>>> 76: final Component parent = c.getParent();
>>> 77:
>>> 78: if (parent instanceof JFrame frameParent) {
>>
>> The `frameParent` variable was declared `final` before.
>> Suggestion:
>>
>> if (parent instanceof final JFrame frameParent) {
>
> Does it really worth keeping `final` here?
> In my opinion it makes code unnecessary longer and harder to read in this case
Agree, `final` doesn't add much value, it's clear the value of `frameParent` doesn't change in the following three lines.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5482
More information about the i18n-dev
mailing list