Class MethodResolutionLogic
- java.lang.Object
-
- com.github.javaparser.resolution.logic.MethodResolutionLogic
-
public class MethodResolutionLogic extends java.lang.Object- Author:
- Federico Tomassetti
-
-
Constructor Summary
Constructors Constructor Description MethodResolutionLogic()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static SymbolReference<ResolvedMethodDeclaration>findMostApplicable(java.util.List<ResolvedMethodDeclaration> methods, java.lang.String name, java.util.List<ResolvedType> argumentsTypes, TypeSolver typeSolver)static SymbolReference<ResolvedMethodDeclaration>findMostApplicable(java.util.List<ResolvedMethodDeclaration> methods, java.lang.String name, java.util.List<ResolvedType> argumentsTypes, TypeSolver typeSolver, boolean wildcardTolerance)static java.util.Optional<MethodUsage>findMostApplicableUsage(java.util.List<MethodUsage> methods, java.lang.String name, java.util.List<ResolvedType> argumentsTypes, TypeSolver typeSolver)static ResolvedTypegetMethodsExplicitAndVariadicParameterType(ResolvedMethodLikeDeclaration method, int i)static ResolvedTypegetMethodUsageExplicitAndVariadicParameterType(MethodUsage method, int i)static voidinferTypes(ResolvedType source, ResolvedType target, java.util.Map<ResolvedTypeParameterDeclaration,ResolvedType> mappings)static booleanisApplicable(ResolvedMethodDeclaration method, java.lang.String name, java.util.List<ResolvedType> argumentsTypes, TypeSolver typeSolver)static booleanisApplicable(MethodUsage methodUsage, java.lang.String needleName, java.util.List<ResolvedType> needleParameterTypes, TypeSolver typeSolver)Checks if a method usage is applicable for a given method name and parameter types.static booleanisAssignableMatchTypeParameters(ResolvedReferenceType expected, ResolvedReferenceType actual, java.util.Map<java.lang.String,ResolvedType> matchedParameters)static booleanisAssignableMatchTypeParameters(ResolvedType expected, ResolvedType actual, java.util.Map<java.lang.String,ResolvedType> matchedParameters)protected static booleanisExactMatch(ResolvedMethodLikeDeclaration method, java.util.List<ResolvedType> argumentsTypes)static ResolvedTypereplaceTypeParam(ResolvedType type, ResolvedTypeParameterDeclaration tp, TypeSolver typeSolver)static SymbolReference<ResolvedMethodDeclaration>solveMethodInType(ResolvedTypeDeclaration typeDeclaration, java.lang.String name, java.util.List<ResolvedType> argumentsTypes)static SymbolReference<ResolvedMethodDeclaration>solveMethodInType(ResolvedTypeDeclaration typeDeclaration, java.lang.String name, java.util.List<ResolvedType> argumentsTypes, boolean staticOnly)
-
-
-
Method Detail
-
isApplicable
public static boolean isApplicable(ResolvedMethodDeclaration method, java.lang.String name, java.util.List<ResolvedType> argumentsTypes, TypeSolver typeSolver)
-
isAssignableMatchTypeParameters
public static boolean isAssignableMatchTypeParameters(ResolvedType expected, ResolvedType actual, java.util.Map<java.lang.String,ResolvedType> matchedParameters)
-
isAssignableMatchTypeParameters
public static boolean isAssignableMatchTypeParameters(ResolvedReferenceType expected, ResolvedReferenceType actual, java.util.Map<java.lang.String,ResolvedType> matchedParameters)
-
replaceTypeParam
public static ResolvedType replaceTypeParam(ResolvedType type, ResolvedTypeParameterDeclaration tp, TypeSolver typeSolver)
-
isApplicable
public static boolean isApplicable(MethodUsage methodUsage, java.lang.String needleName, java.util.List<ResolvedType> needleParameterTypes, TypeSolver typeSolver)
Checks if a method usage is applicable for a given method name and parameter types. This method performs type compatibility checking including generic type variable substitution. Note the specific naming here -- parameters are part of the method declaration, while arguments are the values passed when calling a method. Note that "needle" refers to that value being used as a search/query term to match against.- Returns:
- true, if the given MethodUsage matches the given name/types (normally obtained from a ResolvedMethodDeclaration)
-
findMostApplicable
public static SymbolReference<ResolvedMethodDeclaration> findMostApplicable(java.util.List<ResolvedMethodDeclaration> methods, java.lang.String name, java.util.List<ResolvedType> argumentsTypes, TypeSolver typeSolver)
- Parameters:
methods- we expect the methods to be ordered such that inherited methods are later in the list
-
findMostApplicable
public static SymbolReference<ResolvedMethodDeclaration> findMostApplicable(java.util.List<ResolvedMethodDeclaration> methods, java.lang.String name, java.util.List<ResolvedType> argumentsTypes, TypeSolver typeSolver, boolean wildcardTolerance)
-
isExactMatch
protected static boolean isExactMatch(ResolvedMethodLikeDeclaration method, java.util.List<ResolvedType> argumentsTypes)
-
getMethodsExplicitAndVariadicParameterType
public static ResolvedType getMethodsExplicitAndVariadicParameterType(ResolvedMethodLikeDeclaration method, int i)
-
getMethodUsageExplicitAndVariadicParameterType
public static ResolvedType getMethodUsageExplicitAndVariadicParameterType(MethodUsage method, int i)
-
findMostApplicableUsage
public static java.util.Optional<MethodUsage> findMostApplicableUsage(java.util.List<MethodUsage> methods, java.lang.String name, java.util.List<ResolvedType> argumentsTypes, TypeSolver typeSolver)
-
solveMethodInType
public static SymbolReference<ResolvedMethodDeclaration> solveMethodInType(ResolvedTypeDeclaration typeDeclaration, java.lang.String name, java.util.List<ResolvedType> argumentsTypes)
-
solveMethodInType
public static SymbolReference<ResolvedMethodDeclaration> solveMethodInType(ResolvedTypeDeclaration typeDeclaration, java.lang.String name, java.util.List<ResolvedType> argumentsTypes, boolean staticOnly)
-
inferTypes
public static void inferTypes(ResolvedType source, ResolvedType target, java.util.Map<ResolvedTypeParameterDeclaration,ResolvedType> mappings)
-
-