Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SpEL's CompoundExpression.toStringAST() incorrectly includes . for indexed properties #30610

Closed
sbrannen opened this issue Jun 7, 2023 · 0 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Milestone

Comments

@sbrannen
Copy link
Member

sbrannen commented Jun 7, 2023

I discovered this bug while writing tests for gh-30580.

parseCheck("begrüssung[1]", "begrüssung.[1]"); // extra "." is needed due to erroneous logic in CompoundExpression.toStringAST()

Essentially, an expression like property1[0].property2['key'].methodOne() should have an identical AST string representation; whereas, the current AST string representation is property1.[0].property2.['key'].methodOne() with a . preceding every indexed property access.

@sbrannen sbrannen added type: bug A general bug in: core Issues in core modules (aop, beans, core, context, expression) labels Jun 7, 2023
@sbrannen sbrannen added this to the 6.0.10 milestone Jun 7, 2023
@sbrannen sbrannen self-assigned this Jun 7, 2023
sbrannen added a commit to sbrannen/spring-framework that referenced this issue Jun 7, 2023
mdeinum pushed a commit to mdeinum/spring-framework that referenced this issue Jun 29, 2023
Prior to this commit, if a Spring Expression Language (SpEL) expression
contained indexed access to an object, the generated AST String
representation incorrectly included a dot ('.') before the index access.

For example, 'property[0]' had a generated AST string representation of
'property.[0]'.

This commit addresses this by reworking the logic in
CompoundExpression.toStringAST().

Closes spring-projectsgh-30610
mdeinum pushed a commit to mdeinum/spring-framework that referenced this issue Jun 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Projects
None yet
Development

No branches or pull requests

1 participant