RFR: 8274806: Simplify equals() call on nullable variable and a constant in java.desktop

Sergey Bylokhov serb at openjdk.java.net
Wed Oct 6 06:52:23 UTC 2021


On Sat, 2 Oct 2021 09:14:49 GMT, Andrey Turbanov <github.com+741251+turbanoff at openjdk.org> wrote:

> Flipping arguments of 'equals' method, allows simplifying boolean expressions: now we can remove redundant null check before.

Looks fine

src/java.desktop/share/classes/javax/swing/JSplitPane.java line 1000:

> 998:             leftComponent = comp;
> 999:             index = -1;
> 1000:         } else if (JSplitPane.RIGHT.equals(constraints) ||

I do not think that calling the equals on some object is equivalent to calling the equals on String. Please check other cases for similar issues.

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

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



More information about the client-libs-dev mailing list