Class ExprMirror.InvocationMirror.MethodCtDecl
- java.lang.Object
-
- net.sourceforge.pmd.lang.java.types.internal.infer.ExprMirror.InvocationMirror.MethodCtDecl
-
- All Implemented Interfaces:
OverloadSelectionResult
- Enclosing interface:
- ExprMirror.InvocationMirror
public static class ExprMirror.InvocationMirror.MethodCtDecl extends Object implements OverloadSelectionResult
Information about the overload-resolution for a specific method.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JMethodSig
getMethodType()
Returns the type of the method or constructor that is called by theInvocationNode
.boolean
isFailed()
Returns true if the invocation of this method failed.boolean
isVarargsCall()
Returns true if this is a varargs call.JTypeMirror
ithFormalParam(int i)
Returns the type of the i-th formal parameter of the method.boolean
needsUncheckedConversion()
Whether the declaration needed unchecked conversion to be applicable.String
toString()
-
-
-
Method Detail
-
getMethodType
public JMethodSig getMethodType()
Description copied from interface:OverloadSelectionResult
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
ASTEnumConstant
orASTConstructorCall
), 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 theInvocationNode
will be the type of the anonymous class (hence the difference).- Specified by:
getMethodType
in interfaceOverloadSelectionResult
-
needsUncheckedConversion
public boolean needsUncheckedConversion()
Description copied from interface:OverloadSelectionResult
Whether the declaration needed unchecked conversion to be applicable. In this case, the return type of the method is erased.- Specified by:
needsUncheckedConversion
in interfaceOverloadSelectionResult
-
isVarargsCall
public boolean isVarargsCall()
Description copied from interface:OverloadSelectionResult
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 call
OverloadSelectionResult.ithFormalParam(int)
).- Specified by:
isVarargsCall
in interfaceOverloadSelectionResult
-
ithFormalParam
public JTypeMirror ithFormalParam(int i)
Description copied from interface:OverloadSelectionResult
Returns the type of the i-th formal parameter of the method. This is relevant when the call is varargs:i
can in that case be greater that the number of formal parameters.- Specified by:
ithFormalParam
in interfaceOverloadSelectionResult
- Parameters:
i
- Index for a formal
-
isFailed
public boolean isFailed()
Description copied from interface:OverloadSelectionResult
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.- Specified by:
isFailed
in interfaceOverloadSelectionResult
-
-