if (typeToAdd == null) {
//A special return type for constructors, nice one Eclipse...
signatureBuilder.append("V");
} else {
if (typeToAdd.isArrayType()) {
ArrayType type = (ArrayType) typeToAdd;
int depth = type.getDimensions();
for (int i = 0; i < depth; i++) {
signatureBuilder.append('[');
}
//We still need to add the array component type, which might be primitive or a reference
typeToAdd = type.getElementType();
}
if (typeToAdd.isPrimitiveType()) {
PrimitiveType type = (PrimitiveType) typeToAdd;
signatureBuilder.append(PRIMITIVES_TO_SIGNATURES.get(type.getPrimitiveTypeCode()));
} else if (typeToAdd.isSimpleType()) {
SimpleType type = (SimpleType) typeToAdd;
String name;
if (type.getName().isQualifiedName()) {
name = type.getName().getFullyQualifiedName();
} else {
name = getFullyQualifiedNameForSimpleName(ast, type.getName());
}
name = name.replace('.', '/');
signatureBuilder.append("L").append(name).append(";");
} else if (typeToAdd.isQualifiedType()) {
QualifiedType type = (QualifiedType) typeToAdd;
String name = type.getQualifier().toString().replace('.', '/') + '/' + type.getName().getFullyQualifiedName().replace('.', '/');
signatureBuilder.append("L").append(name).append(";");
} else {
throw new IllegalArgumentException("We hit an unknown type " + typeToAdd);
}
}