public static String constructManglingSignature(JMethod x, String partialSignature) { StringBuilder sb = new StringBuilder(partialSignature); sb.append("__"); for (int i = 0; i < x.getOriginalParamTypes().size(); ++i) { JType type = x.getOriginalParamTypes().get(i); sb.append(type.getJavahSignatureName()); } sb.append(x.getOriginalReturnType().getJavahSignatureName()); return sb.toString(); }
/** Returns a description for a member suitable for reporting errors to the users. */ public static String getReadableDescription(JMember member) { if (member instanceof JField) { return String.format( "%s %s.%s", getReadableDescription(member.getType()), getReadableDescription(member.getEnclosingType()), member.getName()); } JMethod method = (JMethod) member; String printableDescription = ""; if (!method.isConstructor()) { printableDescription += getReadableDescription(method.getType()) + " "; } printableDescription += String.format( "%s.%s(%s)", getReadableDescription(method.getEnclosingType()), method.getName(), Joiner.on(", ") .join( Iterables.transform( method.getOriginalParamTypes(), new Function<JType, String>() { @Override public String apply(JType type) { return getReadableDescription(type); } }))); return printableDescription; }