Interface OverloadSelectionResult
-
public interface OverloadSelectionResultInformation about the overload-resolution for a specific expression.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description JMethodSiggetMethodType()Returns the type of the method or constructor that is called by theInvocationNode.@Nullable JTypeMirrorgetTypeToSearch()Return the type from which the search for accessible candidates for overload resolution starts.booleanisFailed()Returns true if the invocation of this method failed.booleanisVarargsCall()Returns true if this is a varargs call.default JTypeMirrorithFormalParam(int i)Returns the type of the i-th formal parameter of the method.booleanneedsUncheckedConversion()Whether the declaration needed unchecked conversion to be applicable.
-
-
-
Method Detail
-
getMethodType
JMethodSig getMethodType()
Returns the type of the method or constructor that is called by theInvocationNode. This is a method type whose type parameters have been instantiated by their actual inferred values.For constructors the return type of this signature may be different from the type of this node. For an anonymous class constructor (in
ASTEnumConstantorASTConstructorCall), the selected constructor is the *superclass* constructor. In particular, if the anonymous class implements an interface, the constructor is the constructor of classObject. In that case though, theTypeNode.getTypeMirror()of theInvocationNodewill be the type of the anonymous class (hence the difference).
-
needsUncheckedConversion
boolean needsUncheckedConversion()
Whether the declaration needed unchecked conversion to be applicable. In this case, the return type of the method is erased.
-
isVarargsCall
boolean isVarargsCall()
Returns true if this is a varargs call. This means, that the called method is varargs, and was overload-selected in the varargs phase. For example:
In this case, the last formal parameter of the method type should be interpreted specially with-respect-to the argument expressions (seeArrays.asList("a", "b"); // this is a varargs call Arrays.asList(new String[] { "a", "b" }); // this is not a varargs callithFormalParam(int)).
-
ithFormalParam
default JTypeMirror ithFormalParam(int i)
Returns the type of the i-th formal parameter of the method. This is relevant when the call is varargs:ican in that case be greater that the number of formal parameters. In that case, the formal param type is the array element of the vararg parameter, not the array type.- Parameters:
i- Index for a formal- Throws:
AssertionError- If the parameter is negative, or greater than the number of argument expressions to the method
-
isFailed
boolean isFailed()
Returns true if the invocation of this method failed. This means, the presented method type is a fallback, whose type parameters might not have been fully instantiated. This may also mean several methods were ambiguous, and an arbitrary one was chosen.
-
getTypeToSearch
@Experimental @Nullable JTypeMirror getTypeToSearch()
Return the type from which the search for accessible candidates for overload resolution starts. This is just a hint as to where the candidates come from. There may actually be candidates that don't come from this type, eg in the case where this is an unqualified method call, and some candidate methods are imported. The type is null in some cases, eg, this is not implemented for constructor call expressions.- Experimental Status:
- Since 7.14.0
- See Also:
ExprMirror.MethodUsageMirror.getTypeToSearch()
-
-