henrib opened a new pull request, #427: URL: https://github.com/apache/commons-jexl/pull/427
[JEXL-477](https://issues.apache.org/jira/browse/JEXL-477). Stacked on #425 (JEXL-476); the base branch is `JEXL-476` so that only this change shows. ## Problem The expressions embedded in an interpolation string (`` `${...}` ``, `` `#{...}` ``) or in an interpolated property name (`` x.`${...}` ``) were parsed with the features of the engine, not with those of the script that contains them. This only shows when a script is created with its own features through `JexlEngine.createScript(JexlFeatures, JexlInfo, String, String...)`: - engine allowing method calls, script created with `methodCall(false)`: `s.length()` is rejected but `` `${s.length()}` `` evaluated as 3; - conversely, with a restrictive engine and a permissive script, the call was accepted directly and rejected inside the interpolation; - antish names declared by the features of the script (JEXL-474) were not solved inside interpolations: `x.y` evaluated but `` `${x.y}` `` failed. ## Fix The parser hands its current features to the interpolation it creates (`Parser.jjt`, `ASTJxltLiteral`, `ASTIdentifierAccessJxlt`, `JexlParser.parseInterpolation`). `TemplateEngine.createExpression` derives the expression features from them, uses them to parse and as part of the cache key, and nested expressions keep them for their deferred parse. Scripts created with the features of the engine are not affected. All signature changes are in the `parser` and `internal` packages. ## Tests `JxltFeatureEnforcementTest.testInterpolationHonorsScriptFeatures` (both directions, including the cached expression) and `testInterpolationHonorsDeclaredAntish`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
