Class TypeInference
- java.lang.Object
-
- com.github.javaparser.symbolsolver.resolution.typeinference.TypeInference
-
public class TypeInference extends java.lang.Object
The API exposed by the TypeInference subsystem.
-
-
Field Summary
Fields Modifier and Type Field Description private ResolvedType
object
private TypeSolver
typeSolver
-
Constructor Summary
Constructors Constructor Description TypeInference(TypeSolver typeSolver)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private boolean
appearInThrowsClause(ResolvedTypeParameterDeclaration p, ResolvedMethodDeclaration methodDeclaration)
private BoundSet
boundSetup(java.util.List<ResolvedTypeParameterDeclaration> typeParameterDeclarations, java.util.List<InferenceVariable> inferenceVariables)
When inference begins, a bound set is typically generated from a list of type parameter declarations P1, ..., Pp and associated inference variables α1, ..., αpprivate ConstraintFormulaSet
constraintSetFromArgumentsSubstitution(java.util.List<ResolvedType> Fs, java.util.List<Expression> es, Substitution theta, int k)
private java.util.List<ResolvedType>
formalParameterTypes(ResolvedMethodDeclaration methodDeclaration)
void
functionalInterfaceParameterizationInference(LambdaExpr lambdaExpr, ResolvedInterfaceDeclaration interfaceDeclaration)
java.util.Optional<InstantiationSet>
instantiationInference(MethodCallExpr methodCallExpr, ResolvedMethodDeclaration methodDeclaration)
java.util.Optional<InstantiationSet>
instantiationInference(java.util.List<Expression> argumentExpressions, ResolvedMethodDeclaration methodDeclaration)
private static MethodUsage
instantiationSetToMethodUsage(ResolvedMethodDeclaration methodDeclaration, InstantiationSet instantiationSet)
boolean
invocationApplicabilityInference(MethodCallExpr methodCallExpr, ResolvedMethodDeclaration methodDeclaration)
Determine whether a potentially applicable generic method m is applicable for a method invocation that provides no explicit type arguments.void
invocationTypeInference()
BoundSet
invocationTypeInferenceBoundsSetB3()
private boolean
isImplicitlyTyped(LambdaExpr lambdaExpr)
private boolean
isInexact(MethodReferenceExpr methodReferenceExpr)
private boolean
isPertinentToApplicability(Expression argument)
boolean
moreSpecificMethodInference(MethodCallExpr methodCall, ResolvedMethodDeclaration m1, ResolvedMethodDeclaration m2)
Return if m2 is more specific than m1private java.util.Optional<ConstraintFormulaSet>
testForApplicabilityByLooseInvocation(java.util.List<ResolvedType> Fs, java.util.List<Expression> es, Substitution theta)
private java.util.Optional<ConstraintFormulaSet>
testForApplicabilityByStrictInvocation(java.util.List<ResolvedType> Fs, java.util.List<Expression> es, Substitution theta)
private java.util.Optional<ConstraintFormulaSet>
testForApplicabilityByVariableArityInvocation(java.util.List<ResolvedType> Fs, java.util.List<Expression> es, Substitution theta)
static MethodUsage
toMethodUsage(MethodCallExpr call, ResolvedMethodDeclaration methodDeclaration, TypeSolver typeSolver)
private ResolvedType
typeWithSubstitution(ResolvedType originalType, Substitution substitution)
-
-
-
Field Detail
-
object
private final ResolvedType object
-
typeSolver
private TypeSolver typeSolver
-
-
Constructor Detail
-
TypeInference
public TypeInference(TypeSolver typeSolver)
-
-
Method Detail
-
toMethodUsage
public static MethodUsage toMethodUsage(MethodCallExpr call, ResolvedMethodDeclaration methodDeclaration, TypeSolver typeSolver)
-
instantiationInference
public java.util.Optional<InstantiationSet> instantiationInference(MethodCallExpr methodCallExpr, ResolvedMethodDeclaration methodDeclaration)
-
instantiationInference
public java.util.Optional<InstantiationSet> instantiationInference(java.util.List<Expression> argumentExpressions, ResolvedMethodDeclaration methodDeclaration)
-
invocationApplicabilityInference
public boolean invocationApplicabilityInference(MethodCallExpr methodCallExpr, ResolvedMethodDeclaration methodDeclaration)
Determine whether a potentially applicable generic method m is applicable for a method invocation that provides no explicit type arguments.
-
invocationTypeInferenceBoundsSetB3
public BoundSet invocationTypeInferenceBoundsSetB3()
-
invocationTypeInference
public void invocationTypeInference()
-
functionalInterfaceParameterizationInference
public void functionalInterfaceParameterizationInference(LambdaExpr lambdaExpr, ResolvedInterfaceDeclaration interfaceDeclaration)
-
moreSpecificMethodInference
public boolean moreSpecificMethodInference(MethodCallExpr methodCall, ResolvedMethodDeclaration m1, ResolvedMethodDeclaration m2)
Return if m2 is more specific than m1- Parameters:
methodCall
-m1
-m2
-
-
instantiationSetToMethodUsage
private static MethodUsage instantiationSetToMethodUsage(ResolvedMethodDeclaration methodDeclaration, InstantiationSet instantiationSet)
-
boundSetup
private BoundSet boundSetup(java.util.List<ResolvedTypeParameterDeclaration> typeParameterDeclarations, java.util.List<InferenceVariable> inferenceVariables)
When inference begins, a bound set is typically generated from a list of type parameter declarations P1, ..., Pp and associated inference variables α1, ..., αp- Parameters:
typeParameterDeclarations
-inferenceVariables
-- Returns:
-
appearInThrowsClause
private boolean appearInThrowsClause(ResolvedTypeParameterDeclaration p, ResolvedMethodDeclaration methodDeclaration)
-
formalParameterTypes
private java.util.List<ResolvedType> formalParameterTypes(ResolvedMethodDeclaration methodDeclaration)
-
isImplicitlyTyped
private boolean isImplicitlyTyped(LambdaExpr lambdaExpr)
-
isInexact
private boolean isInexact(MethodReferenceExpr methodReferenceExpr)
-
isPertinentToApplicability
private boolean isPertinentToApplicability(Expression argument)
-
testForApplicabilityByStrictInvocation
private java.util.Optional<ConstraintFormulaSet> testForApplicabilityByStrictInvocation(java.util.List<ResolvedType> Fs, java.util.List<Expression> es, Substitution theta)
-
typeWithSubstitution
private ResolvedType typeWithSubstitution(ResolvedType originalType, Substitution substitution)
-
testForApplicabilityByLooseInvocation
private java.util.Optional<ConstraintFormulaSet> testForApplicabilityByLooseInvocation(java.util.List<ResolvedType> Fs, java.util.List<Expression> es, Substitution theta)
-
constraintSetFromArgumentsSubstitution
private ConstraintFormulaSet constraintSetFromArgumentsSubstitution(java.util.List<ResolvedType> Fs, java.util.List<Expression> es, Substitution theta, int k)
-
testForApplicabilityByVariableArityInvocation
private java.util.Optional<ConstraintFormulaSet> testForApplicabilityByVariableArityInvocation(java.util.List<ResolvedType> Fs, java.util.List<Expression> es, Substitution theta)
-
-