CodeQL library for Java

Predicate haveIntersection

Is there a common (reflexive, transitive) subtype of the erasures of types t1 and t2?

If there is no such common subtype, then the two types are disjoint. However, the converse is not true; for example, the parameterized types List<Integer> and Collection<String> are disjoint, but their erasures (List and Collection, respectively) do have common subtypes (such as List itself).

For the definition of the notion of erasure see JLS v8, section 4.6 (Type Erasure).

Import path

import java
predicate haveIntersection(RefType t1, RefType t2)