Predicate indirectlyInstantiates
Generalisation of instantiates that takes subtyping into account:
HashSet<Integer>indirectly instantiatesCollection(but alsoHashSetandSet), with the0-th type parameter beingInteger;- a class
MyList extends ArrayList<Runnable>also instantiatesCollection(as well asAbstractList,AbstractCollectionandList), 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 beingIntegerand the1-th type parameter beingV.
Import path
import semmle.code.java.Collectionspredicate indirectlyInstantiates(RefType t, GenericType g, int i, RefType arg)