Fix resolution of upper bounds of intersection types.

(cherry picked from commit c902985015)
This commit is contained in:
LlamaLad7 committed 2023-08-12 17:38:47 +01:00
1 parent 1cec8b1377
commit 2e4bf962e9
1 file changed
+5
@@ -37,6 +37,7 @@ import javax.lang.model.element.TypeParameterElement;
import javax.lang.model.element.VariableElement;
import javax.lang.model.type.ArrayType;
import javax.lang.model.type.DeclaredType;
import javax.lang.model.type.IntersectionType;
import javax.lang.model.type.TypeKind;
import javax.lang.model.type.TypeMirror;
import javax.lang.model.type.TypeVariable;
@@ -448,6 +449,10 @@ public abstract class TypeUtils {
throw new IllegalStateException("Generic symbol \"" + type + "\" is too complex, exceeded "
+ TypeUtils.MAX_GENERIC_RECURSION_DEPTH + " iterations attempting to determine upper bound");
}
if (type instanceof IntersectionType) {
TypeMirror first = ((IntersectionType) type).getBounds().get(0);
return TypeUtils.getUpperBound0(first, --depth);
}
if (type instanceof DeclaredType) {
return (DeclaredType)type;
}