/**
* Handle special rescues needed implicitly to support concat.
*/
private void rescueByConcat(JType type) {
JClassType stringType = program.getTypeJavaLangString();
JPrimitiveType charType = program.getTypePrimitiveChar();
if (type instanceof JReferenceType && type != stringType
&& type != program.getTypeNull()) {
/*
* Any reference types (except String, which works by default) that take
* part in a concat must rescue java.lang.Object.toString().
*
* TODO: can we narrow the focus by walking up the type hierarchy or
* doing explicit toString calls?
*/
JMethod toStringMethod = program.getIndexedMethod("Object.toString");
rescue(toStringMethod);
} else if (type == charType) {
/*
* Characters must rescue String.valueOf(char)
*/
if (stringValueOfChar == null) {
for (JMethod meth : stringType.getMethods()) {
if (meth.getName().equals("valueOf")) {
List<JType> params = meth.getOriginalParamTypes();
if (params.size() == 1) {
if (params.get(0) == charType) {
stringValueOfChar = meth;