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)
|
||||
return true;
|
||||
|
||||
if (obj != null && obj instanceof MarshalledObject) {
|
||||
MarshalledObject<?> other = (MarshalledObject<?>) obj;
|
||||
if (obj instanceof MarshalledObject<?> other) {
|
||||
|
||||
// if either is a ref to null, both must be
|
||||
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.
|
||||
*
|
||||
* 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) {
|
||||
if (obj != null && obj instanceof LiveRef) {
|
||||
LiveRef ref = (LiveRef) obj;
|
||||
if (obj instanceof LiveRef ref) {
|
||||
|
||||
return (ep.equals(ref.ep) && id.equals(ref.id) &&
|
||||
isLocal == ref.isLocal);
|
||||
@ -189,8 +188,7 @@ public class LiveRef implements Cloneable {
|
||||
}
|
||||
|
||||
public boolean remoteEquals(Object obj) {
|
||||
if (obj != null && obj instanceof LiveRef) {
|
||||
LiveRef ref = (LiveRef) obj;
|
||||
if (obj instanceof LiveRef ref) {
|
||||
|
||||
TCPEndpoint thisEp = ((TCPEndpoint) ep);
|
||||
TCPEndpoint refEp = ((TCPEndpoint) ref.ep);
|
||||
|
@ -489,8 +489,7 @@ public class TCPEndpoint implements Endpoint {
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if ((obj != null) && (obj instanceof TCPEndpoint)) {
|
||||
TCPEndpoint ep = (TCPEndpoint) obj;
|
||||
if (obj instanceof TCPEndpoint ep) {
|
||||
if (port != ep.port || !host.equals(ep.host))
|
||||
return false;
|
||||
if (((csf == null) ^ (ep.csf == null)) ||
|
||||
|
Loading…
Reference in New Issue
Block a user