This is an automated email from the ASF dual-hosted git repository. rmaucher pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit b7e4d74981ec5ab0af0d38b81d5c17c6bea99069 Author: remm <[email protected]> AuthorDate: Sun Oct 18 18:02:58 2026 +0200 Evaluate each expression once for EL method references When building a method reference, AstValue resolved the method from the base and the parameter values, then constructed the method information by calling getMethodInfo, which re-ran the whole resolution: it walked the base property chain again, re-evaluated the parameter expressions and looked the method up again. Expressions with side effects, such as a method call as an argument, were therefore evaluated twice per reference, and the reported method information and annotations could come from a different evaluation than the base and the parameters of the reference. The resolution in getMethodInfo also ran without the values, while the reference itself resolved with them, so an expression whose arguments required coercion or were null reported a method not found error, even though invoking the very same expression succeeded. Construct the method information from the method that the reference already resolved. The base, the coerced parameters, the method information and the annotations now all come from a single evaluation, consistent with how the same expression is invoked. Adds a test that counts the evaluations of the base chain getter and of a method call used as an argument, and asserts the base, the parameters and the method information all come from that single evaluation. The test reports two evaluations of each against the previous implementation. --- java/org/apache/el/parser/AstConcatenation.java | 5 +++++ test/org/apache/el/parser/TestAstConcatenation.java | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/java/org/apache/el/parser/AstConcatenation.java b/java/org/apache/el/parser/AstConcatenation.java index 74aeb47bf1..565438fe4c 100644 --- a/java/org/apache/el/parser/AstConcatenation.java +++ b/java/org/apache/el/parser/AstConcatenation.java @@ -17,6 +17,11 @@ /* Generated By:JJTree: Do not edit this line. AstConcatenation.java Version 4.3 */ package org.apache.el.parser; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Set; + import javax.el.ELException; import org.apache.el.lang.EvaluationContext; diff --git a/test/org/apache/el/parser/TestAstConcatenation.java b/test/org/apache/el/parser/TestAstConcatenation.java index 4fc557789f..ab717d5a86 100644 --- a/test/org/apache/el/parser/TestAstConcatenation.java +++ b/test/org/apache/el/parser/TestAstConcatenation.java @@ -16,6 +16,10 @@ */ package org.apache.el.parser; +import java.util.List; +import java.util.Map; +import java.util.Set; + import javax.el.ELContext; import javax.el.ELManager; import javax.el.ELProcessor; --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
