Skip to content

Commit 8e2d74a

Browse files
committed
Java: Add TypeFlow base case for partially unbound types.
1 parent 22b88ae commit 8e2d74a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

java/ql/lib/semmle/code/java/dataflow/TypeFlow.qll

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,13 @@ private module Input implements TypeFlowInput<Location> {
202202
t1e = t2e and
203203
unbound(t2) and
204204
not unbound(t1)
205+
or
206+
t1e = t2e and
207+
exists(int pos |
208+
partiallyUnbound(t2, pos) and
209+
not partiallyUnbound(t1, pos) and
210+
not unbound(t1)
211+
)
205212
)
206213
}
207214

@@ -370,6 +377,11 @@ private module Input implements TypeFlowInput<Location> {
370377
)
371378
}
372379

380+
/** Holds if `t` is a parameterised type with unrestricted type argument at position `pos`. */
381+
private predicate partiallyUnbound(ParameterizedType t, int pos) {
382+
unconstrained(t.getTypeArgument(pos))
383+
}
384+
373385
Type getErasure(Type t) { result = t.getErasure() }
374386

375387
Type getAnAncestor(Type sub) { result = sub.getAnAncestor() }

0 commit comments

Comments
 (0)