Predicate indirectlyInstantiates
Generalisation of instantiates
that takes subtyping into account:
HashSet<Integer>
indirectly instantiatesCollection
(but alsoHashSet
andSet
), with the0
-th type parameter beingInteger
;- a class
MyList extends ArrayList<Runnable>
also instantiatesCollection
(as well asAbstractList
,AbstractCollection
andList
), with the0
-th type parameter beingRunnable
; - the same is true of
class MyOtherList<T> extends ArrayList<Runnable>
(note that it does not instantiate the type parameter toT
); - a class
MyIntMap<V> extends HashMap<Integer, V>
instantiatesMap
(among others) with the0
-th type parameter beingInteger
and the1
-th type parameter beingV
.
Import path
import semmle.code.java.Collections
predicate
indirectlyInstantiates
(
RefType
t
,
GenericType
g
,
int
i
,
RefType
arg
)