@Override
public void caseSpecialInvokeExpr(SpecialInvokeExpr v) {
instanceInvokeExpr(v);
}
private void instanceInvokeExpr(InstanceInvokeExpr v) {
SootMethodRef m = v.getMethodRef();
if (m.getSignature().equals("<java.lang.String: boolean contains(java.lang.CharSequence)>")) {
if (expected == true) {
Variable base = getBase(v);
Variable arg = getArgument(v, 0);
makeBinaryAssertion(base, arg, new AssertContainsOther());
makeBinaryAssertion(arg, base, new AssertContainedInOther());
}
}
else if (m.getSignature().equals("<java.lang.String: boolean equals(java.lang.Object)>")) {
Variable base = getBase(v);
Variable arg = getArgument(v, 0);
if (expected == true) {
makeBinaryAssertion(base, arg, new AssertEquals());
makeBinaryAssertion(arg, base, new AssertEquals());
} else {
makeBinaryAssertion(base, arg, new AssertNotEquals());
makeBinaryAssertion(arg, base, new AssertNotEquals());
}
}
else if (m.getSignature().equals("<java.lang.String: boolean startsWith(java.lang.String)>")) {
if (expected == true) {
Variable base = getBase(v);
Variable arg = getArgument(v, 0);
makeBinaryAssertion(base, arg, new AssertStartsWith());
makeBinaryAssertion(arg, base, new AssertPrefixOf());
} else {
// TODO negated startsWith assertions [note: it is sound to ignore this]
}
}
else if (m.getSignature().equals("<java.lang.String: boolean endsWith(java.lang.String)>")) {
if (expected == true) {
Variable base = getBase(v);
Variable arg = getArgument(v, 0);
makeBinaryAssertion(base, arg, new AssertEndsWith());
makeBinaryAssertion(arg, base, new AssertSuffixOf());
} else {
// TODO negated endsWith assertions [note: it is sound to ignore this]
}
}
else if (m.getSignature().equals("<java.lang.String: boolean isEmpty()>")) {
Variable base = getBase(v);
if (expected == true) {
makeUnaryAssertion(base, new AssertEmpty());
} else {
makeUnaryAssertion(base, new AssertNotEmpty());
}
}
else if (m.getSignature().equals("<java.lang.String: boolean contentEquals(java.lang.StringBuffer)>")
|| m.getSignature().equals("<java.lang.String: boolean contentEquals(java.lang.CharSequence)>")) {
Variable base = getBase(v);
Variable arg = getArgument(v, 0);
if (expected == true) {
makeBinaryAssertion(base, arg, new AssertEquals());
makeBinaryAssertion(arg, base, new AssertEquals());