1
1
/*
2
- * Copyright 2002-2024 the original author or authors.
2
+ * Copyright 2002-2025 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -250,7 +250,7 @@ else if (typeConverter.canConvert(suppliedArg, TypeDescriptor.valueOf(varargsCom
250
250
* @return {@code true} if some kind of conversion occurred on an argument
251
251
* @throws SpelEvaluationException if a problem occurs during conversion
252
252
*/
253
- public static boolean convertAllArguments (TypeConverter converter , Object [] arguments , Method method )
253
+ public static boolean convertAllArguments (TypeConverter converter , @ Nullable Object [] arguments , Method method )
254
254
throws SpelEvaluationException {
255
255
256
256
Integer varargsPosition = (method .isVarArgs () ? method .getParameterCount () - 1 : null );
@@ -269,7 +269,8 @@ public static boolean convertAllArguments(TypeConverter converter, Object[] argu
269
269
* @return {@code true} if some kind of conversion occurred on an argument
270
270
* @throws EvaluationException if a problem occurs during conversion
271
271
*/
272
- static boolean convertArguments (TypeConverter converter , Object [] arguments , Executable executable ,
272
+ @ SuppressWarnings ("NullAway" ) // Dataflow analysis limitation
273
+ static boolean convertArguments (TypeConverter converter , @ Nullable Object [] arguments , Executable executable ,
273
274
@ Nullable Integer varargsPosition ) throws EvaluationException {
274
275
275
276
boolean conversionOccurred = false ;
@@ -359,7 +360,8 @@ else if (!sourceType.isAssignableTo(componentTypeDesc) ||
359
360
* @throws EvaluationException if a problem occurs during conversion
360
361
* @since 6.1
361
362
*/
362
- public static boolean convertAllMethodHandleArguments (TypeConverter converter , Object [] arguments ,
363
+ @ SuppressWarnings ("NullAway" ) // Dataflow analysis limitation
364
+ public static boolean convertAllMethodHandleArguments (TypeConverter converter , @ Nullable Object [] arguments ,
363
365
MethodHandle methodHandle , @ Nullable Integer varargsPosition ) throws EvaluationException {
364
366
365
367
boolean conversionOccurred = false ;
@@ -453,7 +455,7 @@ else if (!sourceType.isAssignableTo(varargsComponentType) ||
453
455
* @param possibleArray an array object that may have the supplied value as the first element
454
456
* @return true if the supplied value is the first entry in the array
455
457
*/
456
- private static boolean isFirstEntryInArray (Object value , @ Nullable Object possibleArray ) {
458
+ private static boolean isFirstEntryInArray (@ Nullable Object value , @ Nullable Object possibleArray ) {
457
459
if (possibleArray == null ) {
458
460
return false ;
459
461
}
@@ -477,7 +479,7 @@ private static boolean isFirstEntryInArray(Object value, @Nullable Object possib
477
479
* @param args the arguments to be set up for the invocation
478
480
* @return a repackaged array of arguments where any varargs setup has been performed
479
481
*/
480
- public static Object [] setupArgumentsForVarargsInvocation (Class <?>[] requiredParameterTypes , Object ... args ) {
482
+ public static @ Nullable Object [] setupArgumentsForVarargsInvocation (Class <?>[] requiredParameterTypes , @ Nullable Object ... args ) {
481
483
Assert .notEmpty (requiredParameterTypes , "Required parameter types array must not be empty" );
482
484
483
485
int parameterCount = requiredParameterTypes .length ;
@@ -491,7 +493,7 @@ public static Object[] setupArgumentsForVarargsInvocation(Class<?>[] requiredPar
491
493
// Check if repackaging is needed...
492
494
if (parameterCount != argumentCount || !lastRequiredParameterType .isInstance (lastArgument )) {
493
495
// Create an array for the leading arguments plus the varargs array argument.
494
- Object [] newArgs = new Object [parameterCount ];
496
+ @ Nullable Object [] newArgs = new Object [parameterCount ];
495
497
// Copy all leading arguments to the new array, omitting the varargs array argument.
496
498
System .arraycopy (args , 0 , newArgs , 0 , newArgs .length - 1 );
497
499
0 commit comments