leastUpperBound
public static Type leastUpperBound(Set<Type> types)
Compute the "Least Upper Bound" ("lub", jls8 §4.10.4) of a list of type. The "lub" is a shared supertype that is more specific than any
other shared supertype (that is, no other shared supertype is a subtype of the least upper bound)
Parameterized types are currently ignored, as the method is used only to handle Union Types Trees, themselves being used only
in catch trees. Note that Exceptions (any subclass of Throwable) cannot be generic (jls8 §8.1.2, §11.1.1: "compile-time error if a generic
class is a direct or indirect subclass of Throwable")
- Parameters:
types -
- Returns:
- the least upper bound of the types