HDFS-15913. Remove useless NULL checks before instanceof (#2805)

This commit is contained in:
Jack Jiang 2021-03-23 23:51:35 +08:00 committed by GitHub
parent d8ec8ab965
commit 9c2a712597
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 13 additions and 13 deletions

View File

@ -219,7 +219,7 @@ public class BlockStoragePolicy implements BlockStoragePolicySpi {
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == this) { if (obj == this) {
return true; return true;
} else if (obj == null || !(obj instanceof BlockStoragePolicy)) { } else if (!(obj instanceof BlockStoragePolicy)) {
return false; return false;
} }
final BlockStoragePolicy that = (BlockStoragePolicy)obj; final BlockStoragePolicy that = (BlockStoragePolicy)obj;

View File

@ -86,7 +86,7 @@ public class RollingUpgradeInfo extends RollingUpgradeStatus {
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == this) { if (obj == this) {
return true; return true;
} else if (obj == null || !(obj instanceof RollingUpgradeInfo)) { } else if (!(obj instanceof RollingUpgradeInfo)) {
return false; return false;
} }
final RollingUpgradeInfo that = (RollingUpgradeInfo)obj; final RollingUpgradeInfo that = (RollingUpgradeInfo)obj;

View File

@ -51,7 +51,7 @@ public class RollingUpgradeStatus {
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == this) { if (obj == this) {
return true; return true;
} else if (obj == null || !(obj instanceof RollingUpgradeStatus)) { } else if (!(obj instanceof RollingUpgradeStatus)) {
return false; return false;
} }
final RollingUpgradeStatus that = (RollingUpgradeStatus) obj; final RollingUpgradeStatus that = (RollingUpgradeStatus) obj;

View File

@ -622,7 +622,7 @@ public class Dispatcher {
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (this == obj) { if (this == obj) {
return true; return true;
} else if (obj == null || !(obj instanceof StorageGroup)) { } else if (!(obj instanceof StorageGroup)) {
return false; return false;
} else { } else {
final StorageGroup that = (StorageGroup) obj; final StorageGroup that = (StorageGroup) obj;

View File

@ -321,7 +321,7 @@ public class DatanodeStorageInfo {
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (this == obj) { if (this == obj) {
return true; return true;
} else if (obj == null || !(obj instanceof DatanodeStorageInfo)) { } else if (!(obj instanceof DatanodeStorageInfo)) {
return false; return false;
} }
final DatanodeStorageInfo that = (DatanodeStorageInfo)obj; final DatanodeStorageInfo that = (DatanodeStorageInfo)obj;

View File

@ -68,7 +68,7 @@ public class ErrorReportAction implements BPServiceActorAction {
if (this == obj) { if (this == obj) {
return true; return true;
} }
if (obj == null || !(obj instanceof ErrorReportAction)) { if (!(obj instanceof ErrorReportAction)) {
return false; return false;
} }
ErrorReportAction other = (ErrorReportAction) obj; ErrorReportAction other = (ErrorReportAction) obj;

View File

@ -88,7 +88,7 @@ public class ReportBadBlockAction implements BPServiceActorAction {
if (this == obj) { if (this == obj) {
return true; return true;
} }
if (obj == null || !(obj instanceof ReportBadBlockAction)) { if (!(obj instanceof ReportBadBlockAction)) {
return false; return false;
} }
ReportBadBlockAction other = (ReportBadBlockAction) obj; ReportBadBlockAction other = (ReportBadBlockAction) obj;

View File

@ -200,7 +200,7 @@ public class StorageLocation
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null || !(obj instanceof StorageLocation)) { if (!(obj instanceof StorageLocation)) {
return false; return false;
} }
int comp = compareTo((StorageLocation) obj); int comp = compareTo((StorageLocation) obj);

View File

@ -850,7 +850,7 @@ public abstract class INode implements INodeAttributes, Diff.Element<byte[]> {
if (this == that) { if (this == that) {
return true; return true;
} }
if (that == null || !(that instanceof INode)) { if (!(that instanceof INode)) {
return false; return false;
} }
return getId() == ((INode) that).getId(); return getId() == ((INode) that).getId();

View File

@ -275,7 +275,7 @@ public class QuotaCounts {
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == this) { if (obj == this) {
return true; return true;
} else if (obj == null || !(obj instanceof QuotaCounts)) { } else if (!(obj instanceof QuotaCounts)) {
return false; return false;
} }
final QuotaCounts that = (QuotaCounts)obj; final QuotaCounts that = (QuotaCounts)obj;

View File

@ -232,7 +232,7 @@ public class Snapshot implements Comparable<byte[]> {
public boolean equals(Object that) { public boolean equals(Object that) {
if (this == that) { if (this == that) {
return true; return true;
} else if (that == null || !(that instanceof Snapshot)) { } else if (!(that instanceof Snapshot)) {
return false; return false;
} }
return this.id == ((Snapshot)that).id; return this.id == ((Snapshot)that).id;

View File

@ -130,7 +130,7 @@ public class EnumCounters<E extends Enum<E>> {
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == this) { if (obj == this) {
return true; return true;
} else if (obj == null || !(obj instanceof EnumCounters)) { } else if (!(obj instanceof EnumCounters)) {
return false; return false;
} }
final EnumCounters<?> that = (EnumCounters<?>)obj; final EnumCounters<?> that = (EnumCounters<?>)obj;

View File

@ -102,7 +102,7 @@ public class EnumDoubles<E extends Enum<E>> {
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == this) { if (obj == this) {
return true; return true;
} else if (obj == null || !(obj instanceof EnumDoubles)) { } else if (!(obj instanceof EnumDoubles)) {
return false; return false;
} }
final EnumDoubles<?> that = (EnumDoubles<?>)obj; final EnumDoubles<?> that = (EnumDoubles<?>)obj;