protected TypeReference makeTypeBound(final FieldTypeSignature... bounds) {
final TypeReference baseType;
final List<TypeReference> interfaceTypes;
Reifier reifier = null;
if (ArrayUtilities.isNullOrEmpty(bounds)) {
return null;
}
if (bounds[0] != BottomSignature.make()) {
reifier = Reifier.make(this);
bounds[0].accept(reifier);
baseType = reifier.getResult();
assert baseType != null;
}
else {
baseType = null;
}
if (bounds.length == 1) {
return baseType;
}
if (reifier == null) {
reifier = Reifier.make(this);
}
if (bounds.length == 2 && baseType == null) {
bounds[1].accept(reifier);
final TypeReference singleInterface = reifier.getResult();
assert singleInterface != null;
return singleInterface;
}
final TypeReference[] it = new TypeReference[bounds.length - 1];
for (int i = 0; i < it.length; i++) {
bounds[i + 1].accept(reifier);
it[i] = reifier.getResult();
assert it[i] != null;
}
interfaceTypes = ArrayUtilities.asUnmodifiableList(it);