Do not precede indexed access with a dot in SpEL AST representation

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 gh-30610
This commit is contained in:
Sam Brannen
2023-06-07 14:45:44 +02:00
parent dfbed616ba
commit 5ad853ef5b
2 changed files with 22 additions and 5 deletions

View File

@@ -43,6 +43,12 @@ class ParsingTests {
@Nested
class Miscellaneous {
@Test
void compoundExpressions() {
parseCheck("property1.property2.methodOne()");
parseCheck("property1[0].property2['key'].methodOne()");
}
@Test
void supportedCharactersInIdentifiers() {
parseCheck("#var='value'");