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 a String[]
argument. https://github.com/spring-projects/spring-framework/pull/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.
Comment From: LeMikaelF
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.
Comment From: sbrannen
Current work on this issue can be viewed in the following feature branch which is based on this PR.
https://github.com/spring-projects/spring-framework/compare/main...sbrannen:spring-framework:issues/gh-32804-spel-varargs-array-subtype-compilation
Comment From: sbrannen
This has been merged into main
in 29bb7b907c354ebc494afdfe38a0ed6f72f6272c and 12727a2c4f9ba6b7db3a5afa09a43419a5f2c6e7 and revised in 8fe4493a7d5af7df63165ceb8f6d984d7f285a3d.
To see the combined result, view the merged commit 061c13d367740ec144ca7eb89f54f0477db6aac7.
Thanks again for finding the source of the error and taking the initiative to submit a proposal with comprehensive test coverage! 👍