Go to file
Sam Brannen e088892fc1 Support MethodHandle invocation with primitive varargs array in SpEL
Prior to this commit, the Spring Expression Language (SpEL) could not
invoke a varargs MethodHandle function with a primitive array
containing the variable arguments, although that is supported for a
varargs Method function. Attempting to do so resulted in the first
element of the primitive array being supplied as a single argument to
the MethodHandle, effectively ignoring any variable arguments after the
first one.

This commit addresses this by updating the
convertAllMethodHandleArguments(...) method in ReflectionHelper as
follows when the user supplies the varargs already packaged in a
primitive array.

- Regarding conversion, use the wrapper type for a primitive varargs
  array, since we eventually need an Object array in order to invoke
  the MethodHandle in FunctionReference#executeFunctionViaMethodHandle().

- When deciding whether to convert a single element passed as varargs,
  we now check if the argument is an array that is assignable to the
  varargs array type.

- When converting an array supplied as the varargs, we now convert that
  array to the varargs array type instead of the varargs component type.

Note, however, that a SpEL expression cannot provide a primitive array
for an Object[] varargs target. This is due to the fact that the
ArrayToArrayConverter used by Spring's ConversionService does not
support conversion from a primitive array to Object[] -- for example,
from int[] to Object[].

See gh-33191
Closes gh-33198
2024-07-12 17:36:54 +02:00
.github Add missing artifact properties for staging 2024-07-12 08:37:36 +02:00
buildSrc Stop using using legacy locale data for Date/Time formatting tests 2024-07-04 17:03:15 +02:00
framework-api Polish "Replace deprecated usage of project.buildDir" 2023-12-18 16:24:02 +01:00
framework-bom Guard against new Spring modules in ApiDiff task 2022-07-28 10:51:53 +02:00
framework-docs Correct type names in docs on Validation in WebFlux 2024-07-10 17:55:19 +01:00
framework-platform Upgrade to Reactor 2023.0.8 2024-07-09 15:52:09 +02:00
gradle Upgrade to Gradle 8.8 2024-07-04 10:23:15 +02:00
integration-tests Make coroutines with custom AOP aspects work with `@Transactional` 2024-07-10 15:35:43 +02:00
spring-aop Polishing 2024-07-10 15:56:56 +02:00
spring-aspects Skip ajc-compiled aspects for ajc-compiled target classes 2024-06-06 20:42:07 +02:00
spring-beans Polishing 2024-07-10 15:56:56 +02:00
spring-context Polishing 2024-07-10 15:56:56 +02:00
spring-context-indexer Polish 2024-01-17 18:41:15 +01:00
spring-context-support Improve documentation regarding encoding in FreeMarker support 2024-06-25 16:56:48 +02:00
spring-core Retain original URL instance in case of custom URLStreamHandler 2024-07-11 16:15:42 +02:00
spring-core-test Update copyright year of changed files 2024-04-23 15:32:59 +02:00
spring-expression Support MethodHandle invocation with primitive varargs array in SpEL 2024-07-12 17:36:54 +02:00
spring-instrument Ensure all packages declare package-info.java with null-safety annotations 2023-03-10 17:33:52 +01:00
spring-jcl Log4jLog re-resolves ExtendedLogger on deserialization 2023-11-09 11:46:22 +01:00
spring-jdbc Polish 2024-05-23 08:12:30 +02:00
spring-jms Polishing 2024-05-10 12:27:29 +02:00
spring-messaging Polish contribution 2024-07-08 16:51:23 +02:00
spring-orm Add missing hints for Hibernate `@TenantId` 2024-06-06 10:04:35 +02:00
spring-oxm Avoid creation of SAXParserFactory for every read operation 2024-05-21 11:16:19 +02:00
spring-r2dbc Refine null-safety in more modules 2024-03-26 09:46:34 +01:00
spring-test Avoid reader on empty content to be shared by multiple requests 2024-05-20 13:58:36 +02:00
spring-tx Make coroutines with custom AOP aspects work with `@Transactional` 2024-07-10 15:35:43 +02:00
spring-web Fix multipart async servlet request temporary files deletion 2024-07-12 12:50:59 +02:00
spring-webflux Allow tests to pass on Windows JVM (non-UTF-8 default encoding) 2024-07-08 19:42:28 +02:00
spring-webmvc Fix multipart async servlet request temporary files deletion 2024-07-12 12:50:59 +02:00
spring-websocket Polishing 2024-05-07 15:52:13 +02:00
src Apply UnnecessarySemicolonInEnumeration Checkstyle module 2024-03-22 16:30:06 +01:00
.editorconfig
.gitattributes Ensure line endings for binary files are not modified in Git 2019-10-18 11:56:18 +02:00
.gitignore Modernize Antora Build 2024-05-22 10:20:20 +02:00
.sdkmanrc Upgrade to Java 17.0.11 2024-04-22 12:13:01 +02:00
CONTRIBUTING.md Update code-of-conduct email 2024-06-10 10:48:06 +01:00
LICENSE.txt
README.md Update code-of-conduct email 2024-06-10 10:48:06 +01:00
SECURITY.md Mention JAR signing key in SECURITY.md 2023-03-17 22:32:33 +01:00
build.gradle Remove outdated Javadoc links 2024-05-22 14:40:25 +02:00
gradle.properties Next development version (v6.1.12-SNAPSHOT) 2024-07-11 10:14:04 +02:00
gradlew Upgrade to Gradle 8.8 2024-07-04 10:23:15 +02:00
gradlew.bat Upgrade to Gradle 8.6 2024-02-03 11:38:56 +01:00
import-into-eclipse.md Remove Groovy from "Eclipse/STS Project Import Guide" 2022-01-21 11:27:09 +01:00
import-into-idea.md Fix links in Javadoc and reference docs 2022-09-14 17:00:11 +02:00
settings.gradle Fix build warnings 2024-04-30 19:10:31 +02:00
update_copyright_headers.sh Use correct Kotlin file extension in update_copyright_headers.sh 2023-02-19 13:41:36 +01:00

README.md

Spring Framework Build Status Revved up by Develocity

This is the home of the Spring Framework: the foundation for all Spring projects. Collectively the Spring Framework and the family of Spring projects are often referred to simply as "Spring".

Spring provides everything required beyond the Java programming language for creating enterprise applications for a wide range of scenarios and architectures. Please read the Overview section of the reference documentation for a more complete introduction.

Code of Conduct

This project is governed by the Spring Code of Conduct. By participating, you are expected to uphold this code of conduct. Please report unacceptable behavior to spring-code-of-conduct@spring.io.

Access to Binaries

For access to artifacts or a distribution zip, see the Spring Framework Artifacts wiki page.

Documentation

The Spring Framework maintains reference documentation (published and source), GitHub wiki pages, and an API reference. There are also guides and tutorials across Spring projects.

Micro-Benchmarks

See the Micro-Benchmarks wiki page.

Build from Source

See the Build from Source wiki page and the CONTRIBUTING.md file.

Continuous Integration Builds

Information regarding CI builds can be found in the Spring Framework Concourse pipeline documentation.

Stay in Touch

Follow @SpringCentral, @SpringFramework, and its team members on 𝕏. In-depth articles can be found at The Spring Blog, and releases are announced via our releases feed.

License

The Spring Framework is released under version 2.0 of the Apache License.