Unnecessary null check before instanceof removed

This commit is contained in:
Tagir Valeev
2018-01-10 13:26:12 +07:00
parent 4fd89eeb42
commit 023bb2462a
24 changed files with 44 additions and 39 deletions

View File

@@ -63,7 +63,7 @@ public class LinkConstant extends PooledConstant {
@Override
public boolean equals(Object o) {
if (o == this) return true;
if (o == null || !(o instanceof LinkConstant)) return false;
if (!(o instanceof LinkConstant)) return false;
LinkConstant cn = (LinkConstant)o;
return this.type == cn.type &&

View File

@@ -40,7 +40,7 @@ public class PrimitiveConstant extends PooledConstant {
@Override
public boolean equals(Object o) {
if (o == this) return true;
if (o == null || !(o instanceof PrimitiveConstant)) return false;
if (!(o instanceof PrimitiveConstant)) return false;
PrimitiveConstant cn = (PrimitiveConstant)o;
return this.type == cn.type &&

View File

@@ -36,7 +36,7 @@ public class FieldDescriptor {
@Override
public boolean equals(Object o) {
if (o == this) return true;
if (o == null || !(o instanceof FieldDescriptor)) return false;
if (!(o instanceof FieldDescriptor)) return false;
FieldDescriptor fd = (FieldDescriptor)o;
return type.equals(fd.type);

View File

@@ -114,7 +114,7 @@ public class MethodDescriptor {
@Override
public boolean equals(Object o) {
if (o == this) return true;
if (o == null || !(o instanceof MethodDescriptor)) return false;
if (!(o instanceof MethodDescriptor)) return false;
MethodDescriptor md = (MethodDescriptor)o;
return ret.equals(md.ret) && Arrays.equals(params, md.params);

View File

@@ -265,7 +265,7 @@ public class VarType { // TODO: optimize switch
return true;
}
if (o == null || !(o instanceof VarType)) {
if (!(o instanceof VarType)) {
return false;
}