Convert single null
argument to Optional.empty()
in SpEL varargs expression
#27795
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
type: enhancement
A general enhancement
Milestone
Overview
While testing the regression raised in #27719, I noticed that our support for
java.util.Optional
is inconsistent when invoking a method or function that accepts a varargs array of typeOptional
in a SpEL expression.As can be seen in
MethodInvocationTests
, ifnull
is supplied along with other values, eachnull
value gets converted toOptional.empty()
; whereas, anull
value supplied by itself gets passed through asnull
to the invoked method.spring-framework/spring-expression/src/test/java/org/springframework/expression/spel/MethodInvocationTests.java
Lines 305 to 310 in 62f480a
Although this is a very specific use case that potentially does not even exist in a real project, we would like to ensure consistent semantics for
Optional
arguments in SpEL expressions.The text was updated successfully, but these errors were encountered: