Affected Version : 5.3.13

Worked in version : 5.3.6 (5.3.7 -> 5.3.12 not tested)

Using a Spring expression (for caching annotations) started failing for us when moving to Spring 5.3.13 from 5.3.6.

I have created a jUnit Java class test to replicate the issue SpelEvaluation.zip .

Comment From: jhoeller

@sbrannen could this be a side effect of #27582?

Comment From: richardnewtonoa

SpelEvaluation.zip Updated the test case very slightly ... the expression results are not relevant ... the exception thrown in certain cases is the issue (at least for us)

Comment From: sbrannen

@sbrannen could this be a side effect of #27582?

Yes, that looks like it's probably a regression with regard to null handling.

Comment From: sbrannen

I believe the following change (argument != null &&) in ReflectionHelper.convertArguments(...) might fix the regression, but I'd need to verify what the exact behavior was for null values before the regression.

// If the argument is null or if the argument type is equal to the varargs element
// type, there is no need to convert it or wrap it in an array. For example, using
// StringToArrayConverter to convert a String containing a comma would result in the
// String being split and repackaged in an array when it should be used as-is.
if (argument != null && !sourceType.equals(targetType.getElementTypeDescriptor())) {
    arguments[varargsPosition] = converter.convertValue(argument, sourceType, targetType);
}