8289484: Cleanup unnecessary null comparison before instanceof check in java.rmi
Reviewed-by: jpai, attila
This commit is contained in:
parent
9ccae7078e
commit
df063f7db1
@ -213,8 +213,7 @@ public final class MarshalledObject<T> implements Serializable {
|
|||||||
if (obj == this)
|
if (obj == this)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (obj != null && obj instanceof MarshalledObject) {
|
if (obj instanceof MarshalledObject<?> other) {
|
||||||
MarshalledObject<?> other = (MarshalledObject<?>) obj;
|
|
||||||
|
|
||||||
// if either is a ref to null, both must be
|
// if either is a ref to null, both must be
|
||||||
if (objBytes == null || other.objBytes == null)
|
if (objBytes == null || other.objBytes == null)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -178,8 +178,7 @@ public class LiveRef implements Cloneable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj != null && obj instanceof LiveRef) {
|
if (obj instanceof LiveRef ref) {
|
||||||
LiveRef ref = (LiveRef) obj;
|
|
||||||
|
|
||||||
return (ep.equals(ref.ep) && id.equals(ref.id) &&
|
return (ep.equals(ref.ep) && id.equals(ref.id) &&
|
||||||
isLocal == ref.isLocal);
|
isLocal == ref.isLocal);
|
||||||
@ -189,8 +188,7 @@ public class LiveRef implements Cloneable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean remoteEquals(Object obj) {
|
public boolean remoteEquals(Object obj) {
|
||||||
if (obj != null && obj instanceof LiveRef) {
|
if (obj instanceof LiveRef ref) {
|
||||||
LiveRef ref = (LiveRef) obj;
|
|
||||||
|
|
||||||
TCPEndpoint thisEp = ((TCPEndpoint) ep);
|
TCPEndpoint thisEp = ((TCPEndpoint) ep);
|
||||||
TCPEndpoint refEp = ((TCPEndpoint) ref.ep);
|
TCPEndpoint refEp = ((TCPEndpoint) ref.ep);
|
||||||
|
@ -489,8 +489,7 @@ public class TCPEndpoint implements Endpoint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if ((obj != null) && (obj instanceof TCPEndpoint)) {
|
if (obj instanceof TCPEndpoint ep) {
|
||||||
TCPEndpoint ep = (TCPEndpoint) obj;
|
|
||||||
if (port != ep.port || !host.equals(ep.host))
|
if (port != ep.port || !host.equals(ep.host))
|
||||||
return false;
|
return false;
|
||||||
if (((csf == null) ^ (ep.csf == null)) ||
|
if (((csf == null) ^ (ep.csf == null)) ||
|
||||||
|
Loading…
x
Reference in New Issue
Block a user