if (pt==null || pt.getDeclaration()==null) {
return "unknown";
}
else {
if (printAbbreviated()) {
Unit u = pt.getDeclaration().getUnit();
if (abbreviateOptional(pt)) {
ProducedType dt = pt.eliminateNull();
String dtn = getProducedTypeName(dt, unit);
if (isPrimitiveAbbreviatedType(dt)) {
return dtn + "?";
}
else {
return lt() + dtn + gt() + "?";
}
}
if (abbreviateEmpty(pt)) {
return "[]";
}
if (abbreviateSequential(pt)) {
ProducedType it = u.getIteratedType(pt);
String etn = getProducedTypeName(it, unit);
if (isPrimitiveAbbreviatedType(it)) {
return etn + "[]";
}
else {
return lt() + etn + gt() + "[]";
}
}
if (abbreviateSequence(pt)) {
ProducedType it = u.getIteratedType(pt);
String etn = getProducedTypeName(it, unit);
if (isPrimitiveAbbreviatedType(it) ||
it.getDeclaration() instanceof UnionType ||
it.getDeclaration() instanceof IntersectionType ) {
return "[" + etn + "+]";
}
else {
return "[" + lt() + etn + gt() + "+]";
}
}
if (abbreviateIterable(pt)) {
ProducedType it = u.getIteratedType(pt);
ProducedType nt = pt.getTypeArgumentList().get(1);
if (it.isNothing() && !nt.isNothing()) {
return "{}";
}
String itn = getProducedTypeName(it, unit);
String many = nt.isNothing() ? "+" : "*";
if (isPrimitiveAbbreviatedType(it) ||
it.getDeclaration() instanceof UnionType ||
it.getDeclaration() instanceof IntersectionType) {
return "{" + itn + many + "}";
}
else {
return "{" + lt() + itn + gt() + many + "}";
}
}
if (abbreviateEntry(pt)) {
return getProducedTypeName(u.getKeyType(pt), unit) +
"-" + gt()
+ getProducedTypeName(u.getValueType(pt), unit);
}
if (abbreviateCallable(pt)) {
List<ProducedType> tal = pt.getTypeArgumentList();
ProducedType rt = tal.get(0);
ProducedType at = tal.get(1);