Support arrays in AST string representations of SpEL expressions
Prior to this commit, SpEL's ConstructorReference did not provide
support for arrays when generating a string representation of the
internal AST. For example, 'new String[3]' was represented as 'new
String()' instead of 'new String[3]'.
This commit introduces support for standard array construction and array
construction with initializers in ConstructorReference's toStringAST()
implementation.
Closes gh-29665
@ -214,16 +221,33 @@ public class ConstructorReference extends SpelNodeImpl {
@@ -214,16 +221,33 @@ public class ConstructorReference extends SpelNodeImpl {
@Override
publicStringtoStringAST(){
StringBuildersb=newStringBuilder("new ");
intindex=0;
sb.append(getChild(index++).toStringAST());
sb.append('(');
for(inti=index;i<getChildCount();i++){
if(i>index){
sb.append(',');
sb.append(getChild(0).toStringAST());// constructor or array type