Class LeastUpperBound


  • public class LeastUpperBound
    extends Object
    • Method Detail

      • leastUpperBound

        public 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
      • greatestLowerBound

        public static Type greatestLowerBound​(List<Type> types)
        From JLS 8 5.1.10 - greatest lower bound : glb(V1,...,Vm) is defined as V1 & ... & Vm.
        Parameters:
        types -
        Returns: