java.lang.Object
org.checkerframework.framework.util.typeinference8.constraint.TypeConstraint
org.checkerframework.framework.util.typeinference8.constraint.Typing
All Implemented Interfaces:
Constraint, ReductionResult

public class Typing extends TypeConstraint
Represents a constraint between two AbstractType. One of:
  • Constructor Details

    • Typing

      public Typing(AbstractType S, AbstractType t, Constraint.Kind kind)
      Creates a typing constraint.
      Parameters:
      S - left hand side type
      t - right hand side type
      kind - the kind of constraint
    • Typing

      public Typing(AbstractType S, AbstractType t, Constraint.Kind kind, boolean covarTypeArg)
      Creates a typing constraint.
      Parameters:
      S - left hand side type
      t - right hand side type
      kind - the kind of constraint
      covarTypeArg - whether the constraint is for a covariant type argument
  • Method Details

    • getS

      public AbstractType getS()
      Return one of the abstract types in this constraint.
      Returns:
      one of the abstract types in this constraint
    • getKind

      public Constraint.Kind getKind()
      Description copied from interface: Constraint
      Return the kind of constraint.
      Returns:
      the kind of constraint
    • getInputVariables

      public List<Variable> getInputVariables()
      Description copied from class: TypeConstraint
      For lambda and method references constraints, input variables are roughly the inference variables mentioned by they function type's parameter types and return types. For conditional expression constraints and switch expression constraints, input variables are the union of the input variables of its subexpressions. For all other constraints, no input variables exist.

      Defined in JLS section 18.5.2.2

      Specified by:
      getInputVariables in class TypeConstraint
      Returns:
      input variables for this constraint
    • getOutputVariables

      public List<Variable> getOutputVariables()
      Description copied from class: TypeConstraint
      "The output variables of [expression] constraints are all inference variables mentioned by the type on the right-hand side of the constraint, T, that are not input variables."

      As defined in JLS section 18.5.2.2

      Specified by:
      getOutputVariables in class TypeConstraint
      Returns:
      output variables for this constraint
    • getInferenceVariables

      public List<Variable> getInferenceVariables()
      Description copied from class: TypeConstraint
      Returns a collection of all inference variables mentioned by this constraint.
      Overrides:
      getInferenceVariables in class TypeConstraint
      Returns:
      a collection of all inference variables mentioned by this constraint
    • applyInstantiations

      public void applyInstantiations()
      Description copied from class: TypeConstraint
      Apply the given instantiations to any type mentioned in this constraint -- meaning replace any mention of a variable in instantiations with its proper type.
      Overrides:
      applyInstantiations in class TypeConstraint
    • reduce

      public ReductionResult reduce(Java8InferenceContext context)
      Description copied from interface: Constraint
      Reduce this constraint what this means depends on the kind of constraint. Reduction can produce new bounds and/or new constraints.

      Reduction is documented in JLS section 18.2

      Parameters:
      context - Java8InferenceContext
      Returns:
      the result of reducing this constraint
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class TypeConstraint
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class TypeConstraint