java.lang.Object
org.checkerframework.framework.util.typeinference8.types.Dependencies

public class Dependencies extends Object
A data structure to hold the dependencies between variables. Dependencies are defined in JLS section 18.4 and impact the order in which variables are resolved.
  • Constructor Details

    • Dependencies

      public Dependencies()
      Creates Dependencies.
  • Method Details

    • putOrAdd

      public void putOrAdd(Variable key, Variable value)
      Add value as a dependency of key.
      Parameters:
      key - a key to add
      value - a value to add
    • putOrAddAll

      public void putOrAddAll(Variable key, Collection<? extends Variable> values)
      Add values as dependencies of key.
      Parameters:
      key - a key to add
      values - values to add
    • calculateTransitiveDependencies

      public void calculateTransitiveDependencies()
      Calculate and add transitive dependencies.

      JLS 18.4 "An inference variable alpha depends on the resolution of an inference variable beta if there exists an inference variable gamma such that alpha depends on the resolution of gamma and gamma depends on the resolution of beta."

    • dependsOn

      public Set<Variable> dependsOn(Variable alpha)
      Returns a non-modifiable view of the dependencies of alpha. The returned set is backed by the internal map; callers must not mutate it and must treat it as read-only.
      Parameters:
      alpha - a variable
      Returns:
      a non-modifiable view of the dependencies of alpha
    • get

      public Set<Variable> get(Variable alpha)
      Returns a fresh, mutable set of the dependencies of alpha. Use this only when the caller needs to mutate the returned set; otherwise use dependsOn(Variable).
      Parameters:
      alpha - a variable
      Returns:
      a fresh, mutable copy of the dependencies of alpha
    • get

      public Set<Variable> get(Collection<? extends Variable> variables)
      Returns the set of dependencies for all variables in variables. The returned set is freshly allocated and mutable.
      Parameters:
      variables - collection of variables
      Returns:
      the set of dependencies for all variables in variables