Include '?' for null-safe navigation in SpEL AST representations
Prior to this commit, if a Spring Expression Language (SpEL) expression contained property, field, or method references using the null-safe navigation operator (?.), the generated AST String representation incorrectly omitted the '?' characters. For example, 'myProperty?.myMethod()' had a generated AST string representation of 'myProperty.myMethod()'. This commit addresses this by introducing isNullSafe() in MethodReference and reworking the logic in CompoundExpression.toStringAST(). Closes gh-31326
This commit is contained in:
@@ -47,6 +47,7 @@ class ParsingTests {
|
||||
void compoundExpressions() {
|
||||
parseCheck("property1.property2.methodOne()");
|
||||
parseCheck("property1[0].property2['key'].methodOne()");
|
||||
parseCheck("property1?.methodOne()?.property2?.methodTwo()");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user