Skip to content

Fix BZ 70297 - Evaluate a single EL function varargs argument once - #1130

Open
mykolap wants to merge 1 commit into
apache:mainfrom
mykolap:el-varargs-once
Open

mykolap wants to merge 1 commit into
apache:mainfrom
mykolap:el-varargs-once

Conversation

@mykolap

@mykolap mykolap commented Oct 29, 2026

Copy link
Copy Markdown

When an EL function whose method is varargs was called with exactly one argument for the varargs parameter, AstFunction evaluated that argument twice: once to check whether it is already an array and once more for the value. An argument with side effects ran twice, the function received the result of the second evaluation, and an expensive argument cost double.

Evaluate the argument once and use the value both for the array check and as the single varargs element. Calls with two or more varargs values and the single array argument case are unchanged.

Adds a test that counts the evaluations of a method call used as the single varargs argument. The test reports two evaluations against the previous implementation.

When an EL function whose method is varargs was called with exactly one
argument for the varargs parameter, AstFunction evaluated that argument
twice: once to check whether it is already an array and once more for the
value. An argument with side effects ran twice, the function received the
result of the second evaluation, and an expensive argument cost double.

Evaluate the argument once and use the value both for the array check and
as the single varargs element. Calls with two or more varargs values and
the single array argument case are unchanged.

Adds a test that counts the evaluations of a method call used as the
single varargs argument. The test reports two evaluations against the
previous implementation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant