-
Notifications
You must be signed in to change notification settings - Fork 38.2k
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
Support varargs invocations in SpEL for varargs array subtype in compiled expressions #32804
Conversation
spring-expression/src/main/java/org/springframework/expression/spel/ast/SpelNodeImpl.java
Show resolved
Hide resolved
spring-expression/src/main/java/org/springframework/expression/spel/ast/SpelNodeImpl.java
Show resolved
Hide resolved
spring-expression/src/main/java/org/springframework/expression/spel/ast/SpelNodeImpl.java
Show resolved
Hide resolved
...pression/src/test/java/org/springframework/expression/spel/SpelCompilationCoverageTests.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the proposed fix as well as all of the additional tests! 👍
I've left some comments, but there's no need to address those in this PR at this time, since I plan to experiment and potentially make changes locally before merging this work.
Thank you for the comments! I'll keep an eye out for the final fix. |
See spring-projectsgh-32804 Co-authored-by: Mikaël Francoeur <mikael.francoeur@ticketmaster.com>
This commit introduces support for compiling SpEL expressions that contain varargs invocations where the supplied array is a subtype of the declared varargs array type. See spring-projectsgh-32804
Current work on this issue can be viewed in the following feature branch which is based on this PR. main...sbrannen:spring-framework:issues/gh-32804-spel-varargs-array-subtype-compilation |
This commit partially reverts changes to SpelNodeImpl in order to reduce the scope of the overall change set. In addition, this commit revises the previous commit to support type-safe checks for array subtype compatibility. In order to support backward compatibility, this commit also reintroduces generateCodeForArguments(MethodVisitor, CodeFlow, Member, SpelNodeImpl[]) in deprecated form. Closes spring-projectsgh-32804
See gh-32804 Co-authored-by: Mikaël Francoeur <mikael.francoeur@ticketmaster.com>
This commit introduces support for compiling SpEL expressions that contain varargs invocations where the supplied array is a subtype of the declared varargs array type. See gh-32804
This commit first reverts changes to SpelNodeImpl from the previous commit in order to reduce the scope of the overall change set. This commit then implements a different approach to support type-safe checks for array subtype compatibility. In order to support backward compatibility, this commit also reintroduces generateCodeForArguments(MethodVisitor, CodeFlow, Member, SpelNodeImpl[]) in deprecated form. See gh-32804
This PR adds support for varargs invocations where the varargs argument is an array with a component type that is a subtype of the parameter varargs component type. For example, the method accepts an
Object... args
parameter, and it is passed aString[]
argument. #32704 already added support for this in interpreted expressions. There were a few tests that were commented out because compiled expressions didn't support this yet, so I uncommented them and added more tests for functions, methods, and constructors.I will be happy to address any comments on this PR.