Unnecessary null check before instanceof removed

master
Tagir Valeev 7 years ago
parent 4fd89eeb42
commit 023bb2462a
  1. 2
      src/org/jetbrains/java/decompiler/main/rels/NestedClassProcessor.java
  2. 4
      src/org/jetbrains/java/decompiler/modules/decompiler/exps/AnnotationExprent.java
  3. 4
      src/org/jetbrains/java/decompiler/modules/decompiler/exps/ArrayExprent.java
  4. 4
      src/org/jetbrains/java/decompiler/modules/decompiler/exps/AssignmentExprent.java
  5. 4
      src/org/jetbrains/java/decompiler/modules/decompiler/exps/ConstExprent.java
  6. 4
      src/org/jetbrains/java/decompiler/modules/decompiler/exps/ExitExprent.java
  7. 4
      src/org/jetbrains/java/decompiler/modules/decompiler/exps/FieldExprent.java
  8. 4
      src/org/jetbrains/java/decompiler/modules/decompiler/exps/FunctionExprent.java
  9. 8
      src/org/jetbrains/java/decompiler/modules/decompiler/exps/IfExprent.java
  10. 4
      src/org/jetbrains/java/decompiler/modules/decompiler/exps/InvocationExprent.java
  11. 4
      src/org/jetbrains/java/decompiler/modules/decompiler/exps/MonitorExprent.java
  12. 4
      src/org/jetbrains/java/decompiler/modules/decompiler/exps/NewExprent.java
  13. 4
      src/org/jetbrains/java/decompiler/modules/decompiler/exps/SwitchExprent.java
  14. 4
      src/org/jetbrains/java/decompiler/modules/decompiler/exps/VarExprent.java
  15. 2
      src/org/jetbrains/java/decompiler/modules/decompiler/sforms/FlattenStatementsHelper.java
  16. 2
      src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarVersionEdge.java
  17. 2
      src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarVersionPair.java
  18. 2
      src/org/jetbrains/java/decompiler/struct/consts/LinkConstant.java
  19. 2
      src/org/jetbrains/java/decompiler/struct/consts/PrimitiveConstant.java
  20. 2
      src/org/jetbrains/java/decompiler/struct/gen/FieldDescriptor.java
  21. 2
      src/org/jetbrains/java/decompiler/struct/gen/MethodDescriptor.java
  22. 2
      src/org/jetbrains/java/decompiler/struct/gen/VarType.java
  23. 7
      src/org/jetbrains/java/decompiler/util/FastFixedSetFactory.java
  24. 2
      src/org/jetbrains/java/decompiler/util/FastSparseSetFactory.java

@ -910,7 +910,7 @@ public class NestedClassProcessor {
@Override
public boolean equals(Object o) {
if (o == this) return true;
if (o == null || !(o instanceof VarFieldPair)) return false;
if (!(o instanceof VarFieldPair)) return false;
VarFieldPair pair = (VarFieldPair)o;
return fieldKey.equals(pair.fieldKey) && varPair.equals(pair.varPair);

@ -4,10 +4,10 @@
package org.jetbrains.java.decompiler.modules.decompiler.exps;
import org.jetbrains.java.decompiler.main.DecompilerContext;
import org.jetbrains.java.decompiler.util.TextBuffer;
import org.jetbrains.java.decompiler.main.collectors.BytecodeMappingTracer;
import org.jetbrains.java.decompiler.modules.decompiler.ExprProcessor;
import org.jetbrains.java.decompiler.util.InterpreterUtil;
import org.jetbrains.java.decompiler.util.TextBuffer;
import java.util.List;
@ -88,7 +88,7 @@ public class AnnotationExprent extends Exprent {
@Override
public boolean equals(Object o) {
if (o == this) return true;
if (o == null || !(o instanceof AnnotationExprent)) return false;
if (!(o instanceof AnnotationExprent)) return false;
AnnotationExprent ann = (AnnotationExprent)o;
return className.equals(ann.className) &&

@ -3,12 +3,12 @@
*/
package org.jetbrains.java.decompiler.modules.decompiler.exps;
import org.jetbrains.java.decompiler.util.TextBuffer;
import org.jetbrains.java.decompiler.main.collectors.BytecodeMappingTracer;
import org.jetbrains.java.decompiler.modules.decompiler.ExprProcessor;
import org.jetbrains.java.decompiler.modules.decompiler.vars.CheckTypesResult;
import org.jetbrains.java.decompiler.struct.gen.VarType;
import org.jetbrains.java.decompiler.util.InterpreterUtil;
import org.jetbrains.java.decompiler.util.TextBuffer;
import java.util.ArrayList;
import java.util.List;
@ -94,7 +94,7 @@ public class ArrayExprent extends Exprent {
@Override
public boolean equals(Object o) {
if (o == this) return true;
if (o == null || !(o instanceof ArrayExprent)) return false;
if (!(o instanceof ArrayExprent)) return false;
ArrayExprent arr = (ArrayExprent)o;
return InterpreterUtil.equalObjects(array, arr.getArray()) &&

@ -6,13 +6,13 @@ package org.jetbrains.java.decompiler.modules.decompiler.exps;
import org.jetbrains.java.decompiler.code.CodeConstants;
import org.jetbrains.java.decompiler.main.ClassesProcessor.ClassNode;
import org.jetbrains.java.decompiler.main.DecompilerContext;
import org.jetbrains.java.decompiler.util.TextBuffer;
import org.jetbrains.java.decompiler.main.collectors.BytecodeMappingTracer;
import org.jetbrains.java.decompiler.modules.decompiler.ExprProcessor;
import org.jetbrains.java.decompiler.modules.decompiler.vars.CheckTypesResult;
import org.jetbrains.java.decompiler.struct.StructField;
import org.jetbrains.java.decompiler.struct.gen.VarType;
import org.jetbrains.java.decompiler.util.InterpreterUtil;
import org.jetbrains.java.decompiler.util.TextBuffer;
import java.util.ArrayList;
import java.util.List;
@ -162,7 +162,7 @@ public class AssignmentExprent extends Exprent {
@Override
public boolean equals(Object o) {
if (o == this) return true;
if (o == null || !(o instanceof AssignmentExprent)) return false;
if (!(o instanceof AssignmentExprent)) return false;
AssignmentExprent as = (AssignmentExprent)o;
return InterpreterUtil.equalObjects(left, as.getLeft()) &&

@ -5,7 +5,6 @@ package org.jetbrains.java.decompiler.modules.decompiler.exps;
import org.jetbrains.java.decompiler.code.CodeConstants;
import org.jetbrains.java.decompiler.main.DecompilerContext;
import org.jetbrains.java.decompiler.util.TextBuffer;
import org.jetbrains.java.decompiler.main.collectors.BytecodeMappingTracer;
import org.jetbrains.java.decompiler.main.extern.IFernflowerPreferences;
import org.jetbrains.java.decompiler.modules.decompiler.ExprProcessor;
@ -15,6 +14,7 @@ import org.jetbrains.java.decompiler.struct.match.MatchEngine;
import org.jetbrains.java.decompiler.struct.match.MatchNode;
import org.jetbrains.java.decompiler.struct.match.MatchNode.RuleValue;
import org.jetbrains.java.decompiler.util.InterpreterUtil;
import org.jetbrains.java.decompiler.util.TextBuffer;
import org.jetbrains.java.decompiler.util.TextUtil;
import java.util.*;
@ -285,7 +285,7 @@ public class ConstExprent extends Exprent {
@Override
public boolean equals(Object o) {
if (o == this) return true;
if (o == null || !(o instanceof ConstExprent)) return false;
if (!(o instanceof ConstExprent)) return false;
ConstExprent cn = (ConstExprent)o;
return InterpreterUtil.equalObjects(constType, cn.getConstType()) &&

@ -6,7 +6,6 @@ package org.jetbrains.java.decompiler.modules.decompiler.exps;
import org.jetbrains.java.decompiler.code.CodeConstants;
import org.jetbrains.java.decompiler.main.ClassesProcessor.ClassNode;
import org.jetbrains.java.decompiler.main.DecompilerContext;
import org.jetbrains.java.decompiler.util.TextBuffer;
import org.jetbrains.java.decompiler.main.collectors.BytecodeMappingTracer;
import org.jetbrains.java.decompiler.main.rels.MethodWrapper;
import org.jetbrains.java.decompiler.modules.decompiler.ExprProcessor;
@ -16,6 +15,7 @@ import org.jetbrains.java.decompiler.struct.gen.VarType;
import org.jetbrains.java.decompiler.struct.match.MatchEngine;
import org.jetbrains.java.decompiler.struct.match.MatchNode;
import org.jetbrains.java.decompiler.util.InterpreterUtil;
import org.jetbrains.java.decompiler.util.TextBuffer;
import java.util.ArrayList;
import java.util.List;
@ -123,7 +123,7 @@ public class ExitExprent extends Exprent {
@Override
public boolean equals(Object o) {
if (o == this) return true;
if (o == null || !(o instanceof ExitExprent)) return false;
if (!(o instanceof ExitExprent)) return false;
ExitExprent et = (ExitExprent)o;
return exitType == et.getExitType() &&

@ -6,7 +6,6 @@ package org.jetbrains.java.decompiler.modules.decompiler.exps;
import org.jetbrains.java.decompiler.code.CodeConstants;
import org.jetbrains.java.decompiler.main.ClassesProcessor.ClassNode;
import org.jetbrains.java.decompiler.main.DecompilerContext;
import org.jetbrains.java.decompiler.util.TextBuffer;
import org.jetbrains.java.decompiler.main.collectors.BytecodeMappingTracer;
import org.jetbrains.java.decompiler.main.rels.MethodWrapper;
import org.jetbrains.java.decompiler.modules.decompiler.ExprProcessor;
@ -19,6 +18,7 @@ import org.jetbrains.java.decompiler.struct.match.MatchEngine;
import org.jetbrains.java.decompiler.struct.match.MatchNode;
import org.jetbrains.java.decompiler.struct.match.MatchNode.RuleValue;
import org.jetbrains.java.decompiler.util.InterpreterUtil;
import org.jetbrains.java.decompiler.util.TextBuffer;
import org.jetbrains.java.decompiler.util.TextUtil;
import java.util.ArrayList;
@ -155,7 +155,7 @@ public class FieldExprent extends Exprent {
@Override
public boolean equals(Object o) {
if (o == this) return true;
if (o == null || !(o instanceof FieldExprent)) return false;
if (!(o instanceof FieldExprent)) return false;
FieldExprent ft = (FieldExprent)o;
return InterpreterUtil.equalObjects(name, ft.getName()) &&

@ -4,7 +4,6 @@
package org.jetbrains.java.decompiler.modules.decompiler.exps;
import org.jetbrains.java.decompiler.code.CodeConstants;
import org.jetbrains.java.decompiler.util.TextBuffer;
import org.jetbrains.java.decompiler.main.collectors.BytecodeMappingTracer;
import org.jetbrains.java.decompiler.modules.decompiler.ExprProcessor;
import org.jetbrains.java.decompiler.modules.decompiler.vars.CheckTypesResult;
@ -13,6 +12,7 @@ import org.jetbrains.java.decompiler.struct.match.MatchEngine;
import org.jetbrains.java.decompiler.struct.match.MatchNode;
import org.jetbrains.java.decompiler.util.InterpreterUtil;
import org.jetbrains.java.decompiler.util.ListStack;
import org.jetbrains.java.decompiler.util.TextBuffer;
import java.util.*;
@ -413,7 +413,7 @@ public class FunctionExprent extends Exprent {
@Override
public boolean equals(Object o) {
if (o == this) return true;
if (o == null || !(o instanceof FunctionExprent)) return false;
if (!(o instanceof FunctionExprent)) return false;
FunctionExprent fe = (FunctionExprent)o;
return funcType == fe.getFuncType() &&

@ -3,13 +3,15 @@
*/
package org.jetbrains.java.decompiler.modules.decompiler.exps;
import org.jetbrains.java.decompiler.util.TextBuffer;
import org.jetbrains.java.decompiler.main.collectors.BytecodeMappingTracer;
import org.jetbrains.java.decompiler.struct.gen.VarType;
import org.jetbrains.java.decompiler.util.InterpreterUtil;
import org.jetbrains.java.decompiler.util.ListStack;
import org.jetbrains.java.decompiler.util.TextBuffer;
import java.util.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
public class IfExprent extends Exprent {
@ -115,7 +117,7 @@ public class IfExprent extends Exprent {
@Override
public boolean equals(Object o) {
if (o == this) return true;
if (o == null || !(o instanceof IfExprent)) return false;
if (!(o instanceof IfExprent)) return false;
IfExprent ie = (IfExprent)o;
return InterpreterUtil.equalObjects(condition, ie.getCondition());

@ -6,7 +6,6 @@ package org.jetbrains.java.decompiler.modules.decompiler.exps;
import org.jetbrains.java.decompiler.code.CodeConstants;
import org.jetbrains.java.decompiler.main.ClassesProcessor.ClassNode;
import org.jetbrains.java.decompiler.main.DecompilerContext;
import org.jetbrains.java.decompiler.util.TextBuffer;
import org.jetbrains.java.decompiler.main.collectors.BytecodeMappingTracer;
import org.jetbrains.java.decompiler.main.extern.IFernflowerPreferences;
import org.jetbrains.java.decompiler.main.rels.MethodWrapper;
@ -26,6 +25,7 @@ import org.jetbrains.java.decompiler.struct.match.MatchNode;
import org.jetbrains.java.decompiler.struct.match.MatchNode.RuleValue;
import org.jetbrains.java.decompiler.util.InterpreterUtil;
import org.jetbrains.java.decompiler.util.ListStack;
import org.jetbrains.java.decompiler.util.TextBuffer;
import org.jetbrains.java.decompiler.util.TextUtil;
import java.lang.reflect.Method;
@ -539,7 +539,7 @@ public class InvocationExprent extends Exprent {
@Override
public boolean equals(Object o) {
if (o == this) return true;
if (o == null || !(o instanceof InvocationExprent)) return false;
if (!(o instanceof InvocationExprent)) return false;
InvocationExprent it = (InvocationExprent)o;
return InterpreterUtil.equalObjects(name, it.getName()) &&

@ -3,9 +3,9 @@
*/
package org.jetbrains.java.decompiler.modules.decompiler.exps;
import org.jetbrains.java.decompiler.util.TextBuffer;
import org.jetbrains.java.decompiler.main.collectors.BytecodeMappingTracer;
import org.jetbrains.java.decompiler.util.InterpreterUtil;
import org.jetbrains.java.decompiler.util.TextBuffer;
import java.util.ArrayList;
import java.util.List;
@ -61,7 +61,7 @@ public class MonitorExprent extends Exprent {
@Override
public boolean equals(Object o) {
if (o == this) return true;
if (o == null || !(o instanceof MonitorExprent)) return false;
if (!(o instanceof MonitorExprent)) return false;
MonitorExprent me = (MonitorExprent)o;
return monType == me.getMonType() &&

@ -7,7 +7,6 @@ import org.jetbrains.java.decompiler.code.CodeConstants;
import org.jetbrains.java.decompiler.main.ClassWriter;
import org.jetbrains.java.decompiler.main.ClassesProcessor.ClassNode;
import org.jetbrains.java.decompiler.main.DecompilerContext;
import org.jetbrains.java.decompiler.util.TextBuffer;
import org.jetbrains.java.decompiler.main.collectors.BytecodeMappingTracer;
import org.jetbrains.java.decompiler.main.extern.IFernflowerLogger;
import org.jetbrains.java.decompiler.main.extern.IFernflowerPreferences;
@ -20,6 +19,7 @@ import org.jetbrains.java.decompiler.struct.gen.generics.GenericClassDescriptor;
import org.jetbrains.java.decompiler.struct.gen.generics.GenericMain;
import org.jetbrains.java.decompiler.util.InterpreterUtil;
import org.jetbrains.java.decompiler.util.ListStack;
import org.jetbrains.java.decompiler.util.TextBuffer;
import java.util.ArrayList;
import java.util.List;
@ -423,7 +423,7 @@ public class NewExprent extends Exprent {
@Override
public boolean equals(Object o) {
if (o == this) return true;
if (o == null || !(o instanceof NewExprent)) return false;
if (!(o instanceof NewExprent)) return false;
NewExprent ne = (NewExprent)o;
return InterpreterUtil.equalObjects(newType, ne.getNewType()) &&

@ -3,11 +3,11 @@
*/
package org.jetbrains.java.decompiler.modules.decompiler.exps;
import org.jetbrains.java.decompiler.util.TextBuffer;
import org.jetbrains.java.decompiler.main.collectors.BytecodeMappingTracer;
import org.jetbrains.java.decompiler.modules.decompiler.vars.CheckTypesResult;
import org.jetbrains.java.decompiler.struct.gen.VarType;
import org.jetbrains.java.decompiler.util.InterpreterUtil;
import org.jetbrains.java.decompiler.util.TextBuffer;
import java.util.ArrayList;
import java.util.List;
@ -92,7 +92,7 @@ public class SwitchExprent extends Exprent {
return true;
}
if (o == null || !(o instanceof SwitchExprent)) {
if (!(o instanceof SwitchExprent)) {
return false;
}

@ -7,7 +7,6 @@ import org.jetbrains.java.decompiler.code.CodeConstants;
import org.jetbrains.java.decompiler.main.ClassWriter;
import org.jetbrains.java.decompiler.main.ClassesProcessor.ClassNode;
import org.jetbrains.java.decompiler.main.DecompilerContext;
import org.jetbrains.java.decompiler.util.TextBuffer;
import org.jetbrains.java.decompiler.main.collectors.BytecodeMappingTracer;
import org.jetbrains.java.decompiler.main.extern.IFernflowerPreferences;
import org.jetbrains.java.decompiler.main.rels.MethodWrapper;
@ -26,6 +25,7 @@ import org.jetbrains.java.decompiler.struct.match.MatchEngine;
import org.jetbrains.java.decompiler.struct.match.MatchNode;
import org.jetbrains.java.decompiler.struct.match.MatchNode.RuleValue;
import org.jetbrains.java.decompiler.util.InterpreterUtil;
import org.jetbrains.java.decompiler.util.TextBuffer;
import org.jetbrains.java.decompiler.util.TextUtil;
import java.util.ArrayList;
@ -176,7 +176,7 @@ public class VarExprent extends Exprent {
@Override
public boolean equals(Object o) {
if (o == this) return true;
if (o == null || !(o instanceof VarExprent)) return false;
if (!(o instanceof VarExprent)) return false;
VarExprent ve = (VarExprent)o;
return index == ve.getIndex() &&

@ -486,7 +486,7 @@ public class FlattenStatementsHelper {
@Override
public boolean equals(Object o) {
if (o == this) return true;
if (o == null || !(o instanceof FinallyPathWrapper)) return false;
if (!(o instanceof FinallyPathWrapper)) return false;
FinallyPathWrapper fpw = (FinallyPathWrapper)o;
return (source + ":" + destination + ":" + entry).equals(fpw.source + ":" + fpw.destination + ":" + fpw.entry);

@ -24,7 +24,7 @@ public class VarVersionEdge { // FIXME: can be removed?
@Override
public boolean equals(Object o) {
if (o == this) return true;
if (o == null || !(o instanceof VarVersionEdge)) return false;
if (!(o instanceof VarVersionEdge)) return false;
VarVersionEdge edge = (VarVersionEdge)o;
return type == edge.type && source == edge.source && dest == edge.dest;

@ -28,7 +28,7 @@ public class VarVersionPair {
@Override
public boolean equals(Object o) {
if (o == this) return true;
if (o == null || !(o instanceof VarVersionPair)) return false;
if (!(o instanceof VarVersionPair)) return false;
VarVersionPair paar = (VarVersionPair)o;
return var == paar.var && version == paar.version;

@ -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 &&

@ -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 &&

@ -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);

@ -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);

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

@ -1,7 +1,10 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.java.decompiler.util;
import java.util.*;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
public class FastFixedSetFactory<E> {
@ -145,7 +148,7 @@ public class FastFixedSetFactory<E> {
public boolean equals(Object o) {
if (o == this) return true;
if (o == null || !(o instanceof FastFixedSet)) return false;
if (!(o instanceof FastFixedSet)) return false;
int[] extdata = ((FastFixedSet)o).getData();
int[] intdata = data;

@ -263,7 +263,7 @@ public class FastSparseSetFactory<E> {
public boolean equals(Object o) {
if (o == this) return true;
if (o == null || !(o instanceof FastSparseSet)) return false;
if (!(o instanceof FastSparseSet)) return false;
int[] longdata = ((FastSparseSet)o).getData();
int[] shortdata = data;

Loading…
Cancel
Save