class ReflectUtils {

    public static String equalSignatures(Method m1, Method m2) {
        StringBuilder sb = new StringBuilder();

        if (!m1.getReturnType().equals(m2.getReturnType())) {
            sb.append(Strings.get("return_type_mismatch", m1.getReturnType(), m2.getReturnType()));
            sb.append("  ");
        }

        Class<?>[] types1 = m1.getParameterTypes();
        Class<?>[] types2 = m2.getParameterTypes();

        if (types1.length != types2.length) {
            sb.append(Strings.get("parameter_number_mismatch", types1.length, types2.length));
        }
        else { // don't want to go in here if the lengths don't match!!
            for (int i = 0; i < types1.length; i++) {
                if (!types1[i].equals(types2[i])) {
                    sb.append(Strings.get("parameter_type_mismatch", i, types1[i], types2[i]));
                    sb.append("  ");
                }
            }
        }

        if (sb.length() == 0)
            return null;

        sb.append('\n').append(m1.toGenericString());
        sb.append('\n').append(m2.toGenericString());
        return sb.toString();
    }

}