Class DefaultTypeArgumentInference

java.lang.Object
org.checkerframework.framework.util.typeinference8.DefaultTypeArgumentInference
All Implemented Interfaces:
TypeArgumentInference

public class DefaultTypeArgumentInference extends Object implements TypeArgumentInference
Implementation of type argument inference.
  • Constructor Details

    • DefaultTypeArgumentInference

      public DefaultTypeArgumentInference()
      Creates a DefaultTypeArgumentInference.
  • Method Details

    • inferStandalone

      public <R> R inferStandalone(ExpressionTree tree, Supplier<R> computation)
      Returns the result of computation, during which the type arguments of tree are inferred as if tree were not nested in another expression: without inferring the invocations whose inference includes it, and without a target type.
      Type Parameters:
      R - the type of the result
      Parameters:
      tree - a poly expression
      computation - the computation
      Returns:
      the result of computation
    • isInferringStandalone

      public boolean isInferringStandalone()
      Returns:
      true if inferStandalone(com.sun.source.tree.ExpressionTree, java.util.function.Supplier<R>) is running
    • isInferring

      public boolean isInferring()
      Returns true if an inference problem is being solved. While it is, the types of the expressions that are part of the problem are computed without inferring their type arguments.
      Returns:
      true if an inference problem is being solved
    • inferTypeArgs

      public InferenceResult inferTypeArgs(AnnotatedTypeFactory typeFactory, ExpressionTree expressionTree, AnnotatedTypeMirror.AnnotatedExecutableType methodType)
      Description copied from interface: TypeArgumentInference
      Infer the type arguments for the method or constructor invocation given by invocation.
      Specified by:
      inferTypeArgs in interface TypeArgumentInference
      Parameters:
      typeFactory - the type factory used to create methodType
      expressionTree - a tree representing the method or constructor invocation for which we are inferring type arguments
      methodType - the declaration type of method elem
      Returns:
      the result which includes the inferred type arguments or an error message if they were not inferred
    • outerInference

      public static ExpressionTree outerInference(ExpressionTree tree, @Nullable TreePath parentPath)
      Returns the outermost tree required to find the type of tree.
      Parameters:
      tree - tree that may need an outer tree to find the type
      parentPath - path to the parent of tree or null if no such parent exists
      Returns:
      the outermost tree required to find the type of tree