Class TypeInferenceResolver


  • public final class TypeInferenceResolver
    extends java.lang.Object
    • Method Detail

      • getErasedCandidateSet

        public static java.util.Set<java.lang.Class<?>> getErasedCandidateSet​(java.util.List<JavaTypeDefinition> erasedSuperTypeSets)
      • getMinimalErasedCandidateSet

        public static java.util.Set<java.lang.Class<?>> getMinimalErasedCandidateSet​(java.util.Set<java.lang.Class<?>> erasedSet)
      • resolveVariables

        public static java.util.Map<Variable,​JavaTypeDefinition> resolveVariables​(java.util.List<Bound> bounds)
        Resolve unresolved variables in a list of bounds.
      • isProperSubsetOfVariables

        public static boolean isProperSubsetOfVariables​(java.util.List<Variable> variables,
                                                        java.util.Map<Variable,​JavaTypeDefinition> instantiations,
                                                        java.util.Map<Variable,​java.util.Set<Variable>> dependencies,
                                                        java.util.List<Bound> bounds)
        Given a set of inference variables to resolve, let V be the union of this set and all variables upon which the resolution of at least one variable in this set depends.

        ...

        Otherwise, let { α1, ..., αn } be a non-empty subset of uninstantiated variables in V such that i) for all i (1 ≤ i ≤ n), if αi depends on the resolution of a variable β, then either β has an instantiation or there is some j such that β = αj; and Resolution proceeds by generating an instantiation for each of α1, ..., αn based on the bounds in the bound set:

        Returns:
        true, if 'variables' is a resolvable subset
      • boundsHaveAnEqualityBetween

        public static boolean boundsHaveAnEqualityBetween​(java.util.List<Variable> firstList,
                                                          Variable second,
                                                          java.util.List<Bound> bounds)
        Returns:
        true, if 'bounds' contains an equality between 'second' and an element from 'firstList'
      • getInstantiations

        public static java.util.Map<Variable,​JavaTypeDefinition> getInstantiations​(java.util.List<Bound> bounds)
        Returns:
        A map of variable -> proper type produced by searching for α = T or T = α bounds
      • getUninstantiatedVariables

        public static java.util.Set<Variable> getUninstantiatedVariables​(java.util.List<Bound> bounds)
        Returns:
        A list of variables which have no direct instantiations
      • getVariableDependencies

        public static java.util.Map<Variable,​java.util.Set<Variable>> getVariableDependencies​(java.util.List<Bound> bounds)
      • getMentionedVariables

        public static java.util.Set<Variable> getMentionedVariables​(java.util.List<Bound> bounds)
        Returns:
        a set of variables mentioned by the bounds
      • incorporateBounds

        public static java.util.List<Constraint> incorporateBounds​(java.util.List<Bound> currentBounds,
                                                                   java.util.List<Bound> newBounds)
        https://docs.oracle.com/javase/specs/jls/se8/html/jls-18.html#jls-18.3