Package org.sonar.java.resolve
Class LeastUpperBound
- java.lang.Object
-
- org.sonar.java.resolve.LeastUpperBound
-
public class LeastUpperBound extends Object
-
-
Constructor Summary
Constructors Constructor Description LeastUpperBound(TypeSubstitutionSolver typeSubstitutionSolver, ParametrizedTypeCache parametrizedTypeCache, Symbols symbols)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Type
greatestLowerBound(List<Type> types)
From JLS 8 5.1.10 - greatest lower bound : glb(V1,...,Vm) is defined as V1 & ...Type
leastUpperBound(Set<Type> types)
Compute the "Least Upper Bound" ("lub", jls8 §4.10.4) of a list of type.
-
-
-
Constructor Detail
-
LeastUpperBound
public LeastUpperBound(TypeSubstitutionSolver typeSubstitutionSolver, ParametrizedTypeCache parametrizedTypeCache, Symbols symbols)
-
-
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
-
-