use of org.abs_models.frontend.typechecker.BoundedType in project abstools by abstools.
the class JavaBackend method getQualifiedString.
public static String getQualifiedString(Type absType) {
String res = null;
if (absType.isDataType()) {
DataTypeType dt = (DataTypeType) absType;
res = dataTypeMap.get(dt.getDecl().getName());
if (res != null)
return res;
StringBuilder sb = new StringBuilder();
if (dt.hasTypeArgs() && !containsUnboundedType(dt.getTypeArgs())) {
sb.append("<");
boolean first = true;
for (Type t : dt.getTypeArgs()) {
if (first)
first = false;
else
sb.append(',');
sb.append(getQualifiedString(t));
}
sb.append(">");
}
return getQualifiedString(dt.getDecl()) + sb.toString();
/*
* if (dt.hasTypeArgs() && !containsUnboundedType(dt.getTypeArgs()))
* {
*
* sb.append("<"); boolean first = true; for (Type t :
* dt.getTypeArgs()) { if (first) first = false; else
* sb.append(','); sb.append(getQualifiedString(t)); }
* sb.append(">"); }
*/
} else if (absType.isInterfaceType()) {
InterfaceType it = (InterfaceType) absType;
return getQualifiedString(it.getDecl());
} else if (absType.isTypeParameter()) {
TypeParameter tp = (TypeParameter) absType;
return tp.getDecl().getName();
} else if (absType.isBoundedType()) {
BoundedType bt = (BoundedType) absType;
if (bt.hasBoundType())
return getQualifiedString(bt.getBoundType());
return "?";
} else if (absType.isAnyType()) {
return "java.lang.Object";
} else if (absType.isUnionType()) {
return getQualifiedString(((UnionType) absType).getOriginatingClass());
}
throw new RuntimeException("Type " + absType.getClass().getName() + " not yet supported by Java backend");
}
Aggregations