RFR: 8263358: Update java.lang to use instanceof pattern variable

Alan Bateman alanb at openjdk.java.net
Thu Mar 11 08:59:07 UTC 2021


On Wed, 10 Mar 2021 12:59:18 GMT, Patrick Concannon <pconcannon at openjdk.org> wrote:

> Hi,
> 
> Could someone please review my code for updating the code in the `java.lang` package to make use of the `instanceof` pattern variable?
> 
> Kind regards,
> Patrick

src/java.base/share/classes/java/lang/module/ModuleDescriptor.java line 313:

> 311:         @Override
> 312:         public boolean equals(Object ob) {
> 313:             if (!(ob instanceof Requires that))

it would be nicer if you inverted this to return (ob instanced Requires that) && ...
Same thing for the equals methods in Exports, Opens, Provides, ...

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

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


More information about the core-libs-dev mailing list