mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8258422: Cleanup unnecessary null comparison before instanceof check in java.base
Reviewed-by: chegar, aefimov
This commit is contained in:
parent
ff54b77b76
commit
022bc9f0cb
22 changed files with 69 additions and 81 deletions
|
@ -119,9 +119,8 @@ public class InetSocketAddress
|
|||
|
||||
@Override
|
||||
public final boolean equals(Object obj) {
|
||||
if (obj == null || !(obj instanceof InetSocketAddressHolder))
|
||||
if (!(obj instanceof InetSocketAddressHolder that))
|
||||
return false;
|
||||
InetSocketAddressHolder that = (InetSocketAddressHolder)obj;
|
||||
boolean sameIP;
|
||||
if (addr != null)
|
||||
sameIP = addr.equals(that.addr);
|
||||
|
@ -409,9 +408,10 @@ public class InetSocketAddress
|
|||
*/
|
||||
@Override
|
||||
public final boolean equals(Object obj) {
|
||||
if (obj == null || !(obj instanceof InetSocketAddress))
|
||||
return false;
|
||||
return holder.equals(((InetSocketAddress) obj).holder);
|
||||
if (obj instanceof InetSocketAddress addr) {
|
||||
return holder.equals(addr.holder);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue