Package sootup.core.jimple.basic
Class JimpleComparator
java.lang.Object
sootup.core.jimple.basic.JimpleComparator
- Direct Known Subclasses:
IgnoreLocalNameComparator
This class contains the equivalence implementations for the individual
EquivTo.equivTo(Object) methods of the Jimple IR. You can use it as your base class if your use
case needs an adjustment for checking structural equivalence. This follows a contract weaker than
Object.equals(Object):
X x = ...; Y y = ...; x.equivTo(y); will check whether y is an instance of
X and whether the properties known to X are equal in both objects.
- It is reflexive: for any non-null reference value
x,x.equivTo(x)should returntrue. - In contrast to
Object.equals(Object)it is not necessarily symmetric: Consider reference valuesFoo xandBar ywhereclass Bar extends Foo. Ifx.equivTo(y)returnstrue, it is still valid fory.equivTo(x)to returnfalse. This is becausex.equivTo(y)will only compare the properties defined inFoo. IfBarhas added any other properties, it will also take these into consideration for the comparison. SinceFoodoes not contain them,y.equivTo(x)will returnfalsein this case. - In contrast to
Object.equals(Object)it is not necessarily transitive. This is because it is reflexive, but not necessarily symmetric. This means that whenx.equivTo(y) == trueandy.equivTo(z) == true, this does not implyx.equivTo(z) == true. A trivial example showing this is whenxrefers to the same object asz, sinceequivTois not always symmetric. - It is consistent: for any non-null reference values
xandy, multiple invocations ofx.equivTo(y)consistently returntrueor consistently returnfalse, provided no information used inequivTocomparisons on the objects is modified. - For any non-null reference value
x,x.equivTo(null)should returnfalse.
- Author:
- Markus Schmidt
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanprotected booleanbooleancaseArrayRef(JArrayRef obj, Object o) booleancaseAssignStmt(JAssignStmt stmt, Object o) booleancaseBlock(BasicBlock<?> block, Object o) booleancaseBreakpointStmt(JBreakpointStmt stmt, Object o) booleancaseCastExpr(JCastExpr v, Object o) booleanbooleancaseConstant(Constant constant, Object o) booleanbooleancaseEnterMonitorStmt(JEnterMonitorStmt stmt, Object o) booleancaseExitMonitorStmt(JExitMonitorStmt stmt, Object o) booleancaseGotoStmt(JGotoStmt stmt, Object o) booleancaseIdentityStmt(JIdentityStmt stmt, Object o) booleancaseIfStmt(JIfStmt stmt, Object o) booleanbooleanbooleanbooleancaseInvokeStmt(JInvokeStmt stmt, Object o) booleancaseJPhiExpr(JPhiExpr v, Object o) booleancaseLengthExpr(JLengthExpr v, Object o) booleanbooleancaseNegExpr(JNegExpr v, Object o) booleanbooleancaseNewExpr(JNewExpr v, Object o) booleanbooleancaseNopStmt(JNopStmt stmt, Object o) booleancaseParameterRef(JParameterRef obj, Object o) booleancaseRetStmt(JRetStmt stmt, Object o) booleancaseReturnStmt(JReturnStmt stmt, Object o) booleancaseReturnVoidStmt(JReturnVoidStmt stmt, Object o) booleanbooleancaseStaticFieldRef(JStaticFieldRef obj, Object o) booleanbooleanbooleancaseSwitchStmt(JSwitchStmt stmt, Object o) assumes that different sequence of (otherwise equivalent) cases means values are not considered equivalentbooleancaseThisRef(JThisRef obj, Object o) booleancaseThrowStmt(JThrowStmt stmt, Object o) booleanstatic JimpleComparatorReturns the defaultJimpleComparator.
-
Constructor Details
-
JimpleComparator
public JimpleComparator()
-
-
Method Details
-
getInstance
Returns the defaultJimpleComparator. You may customize the behavior by extendingJimpleComparatorand overriding methods. -
caseLocal
-
caseBlock
-
caseStmt
-
caseBreakpointStmt
-
caseInvokeStmt
-
caseAssignStmt
-
caseIdentityStmt
-
caseEnterMonitorStmt
-
caseExitMonitorStmt
-
caseGotoStmt
-
caseIfStmt
-
caseSwitchStmt
assumes that different sequence of (otherwise equivalent) cases means values are not considered equivalent -
caseNopStmt
-
caseRetStmt
-
caseReturnStmt
-
caseReturnVoidStmt
-
caseThrowStmt
-
caseAbstractBinopExpr
-
caseStaticInvokeExpr
-
caseDynamicInvokeExpr
-
caseCastExpr
-
caseInstanceOfExpr
-
caseNewArrayExpr
-
caseNewMultiArrayExpr
-
caseJPhiExpr
-
caseNewExpr
-
caseLengthExpr
-
caseNegExpr
-
caseAbstractInstanceInvokeExpr
-
caseInterfaceInvokeExpr
-
caseSpecialInvokeExpr
-
caseVirtualInvokeExpr
-
caseArrayRef
-
caseCaughtException
-
caseInstanceFieldRef
-
caseParameterRef
-
caseStaticFieldRef
-
caseThisRef
-
caseConstant
-