return result;
// String.split(String)
} else if (methodName.equals("split") && numArgs == 1) {
Variable result = factory.createVariable(VariableType.ARRAY);
factory.addStatement(new BasicUnaryOp(result, callee, new Split()));
return result;
// String.charAt(int)
} else if (methodName.equals("charAt") && numArgs == 1) {
UnaryOperation op;
Integer arg = trackInteger(expr.getArg(0));
if (arg != null) {
op = new CharAt1(arg);
} else {
op = new CharAt2();
}
Variable result = factory.createVariable(VariableType.PRIMITIVE);
factory.addStatement(new BasicUnaryOp(result, callee, op));
return result;
// String.contains(CharSequence)
} else if (methodName.equals("contains") && numArgs == 1) {
// this is experimental stuff. it is working, but probably not that useful
Variable result = factory.createVariable(VariableType.PRIMITIVE);
factory.addStatement(new BasicBinaryOp(result, callee, arguments.get(0), new Contains()));
return result;
// String.contentEquals(CharSequence) and String.contentEquals(StringBuffer)
} else if (methodName.equals("contentEquals") && numArgs == 1) {
// we can't say anything meaningful except the argument is NOT corrupted
// (the argument will be considered corrupted if we do not handle it here)
Variable result = factory.createVariable(VariableType.PRIMITIVE);
factory.addStatement(new PrimitiveInit(result, Basic.getBinaryBooleans()));
return result;
}
// String.toCharArray()
else if (methodName.equals("toCharArray") && numArgs == 0) {
Variable result = factory.createVariable(VariableType.ARRAY);
factory.addStatement(new ArrayNew(result));
Variable charAt = factory.createVariable(VariableType.PRIMITIVE);
factory.addStatement(new BasicUnaryOp(charAt, callee, new CharAt2()));
factory.addStatement(new ArrayWriteElement(result, charAt));
return result;
}