HADOOP-17599. Remove NULL checks before instanceof (#2804)

This commit is contained in:
Jack Jiang 2021-03-23 23:46:11 +08:00 committed by GitHub
parent d77c7ab4e0
commit d8ec8ab965
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 20 additions and 21 deletions

View File

@ -1353,7 +1353,7 @@ public abstract class AbstractFileSystem implements PathCapabilities {
@Override //Object
public boolean equals(Object other) {
if (other == null || !(other instanceof AbstractFileSystem)) {
if (!(other instanceof AbstractFileSystem)) {
return false;
}
return myUri.equals(((AbstractFileSystem) other).myUri);

View File

@ -97,7 +97,7 @@ public class DelegationTokenRenewer
public boolean equals(final Object that) {
if (this == that) {
return true;
} else if (that == null || !(that instanceof RenewAction)) {
} else if (!(that instanceof RenewAction)) {
return false;
}
return token.equals(((RenewAction<?>)that).token);

View File

@ -47,7 +47,7 @@ public abstract class FileChecksum implements Writable {
if (other == this) {
return true;
}
if (other == null || !(other instanceof FileChecksum)) {
if (!(other instanceof FileChecksum)) {
return false;
}

View File

@ -93,7 +93,7 @@ public class RpcCallCache {
if (this == obj) {
return true;
}
if (obj == null || !(obj instanceof ClientRequest)) {
if (!(obj instanceof ClientRequest)) {
return false;
}
ClientRequest other = (ClientRequest) obj;

View File

@ -188,8 +188,7 @@ public class MockWasbAuthorizerImpl implements WasbAuthorizerInterface {
return true;
}
if (obj == null
|| !(obj instanceof AuthorizationComponent)) {
if (!(obj instanceof AuthorizationComponent)) {
return false;
}

View File

@ -45,7 +45,7 @@ public abstract class GetAllResourceProfilesResponse {
if (this == other) {
return true;
}
if (other == null || !(other instanceof GetAllResourceProfilesResponse)) {
if (!(other instanceof GetAllResourceProfilesResponse)) {
return false;
}
return ((GetAllResourceProfilesResponse) other).getResourceProfiles()

View File

@ -45,7 +45,7 @@ public abstract class GetAllResourceTypeInfoResponse {
if (this == other) {
return true;
}
if (other == null || !(other instanceof GetAllResourceTypeInfoResponse)) {
if (!(other instanceof GetAllResourceTypeInfoResponse)) {
return false;
}
return ((GetAllResourceTypeInfoResponse) other).getResourceTypeInfo()

View File

@ -45,7 +45,7 @@ public abstract class GetResourceProfileRequest {
if (this == other) {
return true;
}
if (other == null || !(other instanceof GetResourceProfileRequest)) {
if (!(other instanceof GetResourceProfileRequest)) {
return false;
}
return this.getProfileName()

View File

@ -54,7 +54,7 @@ public abstract class GetResourceProfileResponse {
return true;
}
if (other == null || !(other instanceof GetResourceProfileResponse)) {
if (!(other instanceof GetResourceProfileResponse)) {
return false;
}
return this.getResource()

View File

@ -139,7 +139,7 @@ public class LightWeightResource extends Resource {
if (this == obj) {
return true;
}
if (obj == null || !(obj instanceof Resource)) {
if (!(obj instanceof Resource)) {
return false;
}
Resource other = (Resource) obj;

View File

@ -68,7 +68,7 @@ public class Log4jWarningErrorMetricsAppender extends AppenderSkeleton {
@Override
public boolean equals(Object e) {
if (e == null || !(e instanceof PurgeElement)) {
if (!(e instanceof PurgeElement)) {
return false;
}
if (e == this) {

View File

@ -43,7 +43,7 @@ public class VolumeId {
@Override
public boolean equals(Object obj) {
if (obj == null || !(obj instanceof VolumeId)) {
if (!(obj instanceof VolumeId)) {
return false;
}
return StringUtils.equalsIgnoreCase(volumeId,

View File

@ -135,7 +135,7 @@ public class PrivilegedOperation {
@Override
public boolean equals(Object other) {
if (other == null || !(other instanceof PrivilegedOperation)) {
if (!(other instanceof PrivilegedOperation)) {
return false;
}

View File

@ -49,7 +49,7 @@ public class AssignedDevice implements Serializable, Comparable {
@Override
public int compareTo(Object o) {
if (o == null || !(o instanceof AssignedDevice)) {
if (!(o instanceof AssignedDevice)) {
return -1;
}
AssignedDevice other = (AssignedDevice) o;
@ -62,7 +62,7 @@ public class AssignedDevice implements Serializable, Comparable {
@Override
public boolean equals(Object o) {
if (o == null || !(o instanceof AssignedDevice)) {
if (!(o instanceof AssignedDevice)) {
return false;
}
AssignedDevice other = (AssignedDevice) o;

View File

@ -44,7 +44,7 @@ public class AssignedGpuDevice extends GpuDevice {
@Override
public boolean equals(Object obj) {
if (obj == null || !(obj instanceof AssignedGpuDevice)) {
if (!(obj instanceof AssignedGpuDevice)) {
return false;
}
AssignedGpuDevice other = (AssignedGpuDevice) obj;
@ -54,7 +54,7 @@ public class AssignedGpuDevice extends GpuDevice {
@Override
public int compareTo(Object obj) {
if (obj == null || (!(obj instanceof AssignedGpuDevice))) {
if ((!(obj instanceof AssignedGpuDevice))) {
return -1;
}

View File

@ -43,7 +43,7 @@ public class GpuDevice implements Serializable, Comparable {
@Override
public boolean equals(Object obj) {
if (obj == null || !(obj instanceof GpuDevice)) {
if (!(obj instanceof GpuDevice)) {
return false;
}
GpuDevice other = (GpuDevice) obj;
@ -52,7 +52,7 @@ public class GpuDevice implements Serializable, Comparable {
@Override
public int compareTo(Object obj) {
if (obj == null || (!(obj instanceof GpuDevice))) {
if (!(obj instanceof GpuDevice)) {
return -1;
}

View File

@ -54,7 +54,7 @@ public final class ContainerRuntimeContext {
@Override
public boolean equals(Object obj) {
if (obj == null || !(obj instanceof Attribute)){
if (!(obj instanceof Attribute)){
return false;
}