Java: Add TypeFlow base case for partially unbound types.

This commit is contained in:
Anders Schack-Mulligen
2026-01-12 12:45:06 +01:00
parent 22b88aea06
commit 8e2d74a7b1

View File

@@ -202,6 +202,13 @@ private module Input implements TypeFlowInput<Location> {
t1e = t2e and
unbound(t2) and
not unbound(t1)
or
t1e = t2e and
exists(int pos |
partiallyUnbound(t2, pos) and
not partiallyUnbound(t1, pos) and
not unbound(t1)
)
)
}
@@ -370,6 +377,11 @@ private module Input implements TypeFlowInput<Location> {
)
}
/** Holds if `t` is a parameterised type with unrestricted type argument at position `pos`. */
private predicate partiallyUnbound(ParameterizedType t, int pos) {
unconstrained(t.getTypeArgument(pos))
}
Type getErasure(Type t) { result = t.getErasure() }
Type getAnAncestor(Type sub) { result = sub.getAnAncestor() }