Class EqualitiesSolver


  • public class EqualitiesSolver
    extends java.lang.Object
    EqualitiesSolver infers type arguments for targets using the equality constraints in ConstraintMap. When a type is inferred, it rewrites the remaining equality/supertype constraints
    • Constructor Detail

      • EqualitiesSolver

        public EqualitiesSolver()
    • Method Detail

      • solveEqualities

        public InferenceResult solveEqualities​(java.util.Set<javax.lang.model.type.TypeVariable> targets,
                                               ConstraintMap constraintMap,
                                               AnnotatedTypeFactory typeFactory)
        For each target, if there is one or more equality constraints involving concrete types that lets us infer a primary annotation in all qualifier hierarchies then infer a concrete type argument. else if there is one or more equality constraints involving other targets that lets us infer a primary annotation in all qualifier hierarchies then infer that type argument is the other type argument

        if we have inferred either a concrete type or another target as type argument rewrite all of the constraints for the current target to instead use the inferred type/target

        We do this iteratively until NO new inferred type argument is found

        Parameters:
        targets - the list of type parameters for which we are inferring type arguments
        constraintMap - the set of constraints over the set of targets
        Returns:
        a Map from target to (inferred type or target)