-
Notifications
You must be signed in to change notification settings - Fork 38.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support MethodHandle function invocation with zero varargs in SpEL
Prior to this commit, the Spring Expression Language (SpEL) could not invoke a varargs MethodHandle function with zero variable arguments, even though the variable arguments are not required. Attempting to do so resulted in a SpelEvaluationException with an INCORRECT_NUMBER_OF_ARGUMENTS_TO_FUNCTION message. This commit addresses this by updating the executeFunctionViaMethodHandle(...) method in FunctionReference so that it properly checks the required number of arguments for both varargs and non-varargs MethodHandle invocations. This commit also improves the error message for varargs invocations with too few arguments. For example, if the MethodHandle requires at least 1 argument plus a variable number of additional arguments and 0 arguments were supplied, the error message now states: "Incorrect number of arguments for function 'myFunc': 0 supplied but function takes 1 or more" Instead of: "Incorrect number of arguments for function 'myFunc': 0 supplied but function takes 2" Closes gh-33190
- Loading branch information
Showing
3 changed files
with
44 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters