Browse Source

Specify nullability @⁠Contract for TypeDescriptor.array()

pull/33213/head
Sam Brannen 1 year ago
parent
commit
59b9404956
  1. 1
      spring-core/src/main/java/org/springframework/core/convert/TypeDescriptor.java
  2. 1
      spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectionHelper.java

1
spring-core/src/main/java/org/springframework/core/convert/TypeDescriptor.java

@ -644,6 +644,7 @@ public class TypeDescriptor implements Serializable { @@ -644,6 +644,7 @@ public class TypeDescriptor implements Serializable {
* @since 3.2.1
*/
@Nullable
@Contract("!null -> !null; null -> null")
public static TypeDescriptor array(@Nullable TypeDescriptor elementTypeDescriptor) {
if (elementTypeDescriptor == null) {
return null;

1
spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectionHelper.java

@ -389,7 +389,6 @@ public abstract class ReflectionHelper { @@ -389,7 +389,6 @@ public abstract class ReflectionHelper {
// FunctionReference#executeFunctionViaMethodHandle().
Class<?> varargsComponentClass = ClassUtils.resolvePrimitiveIfNecessary(varargsArrayClass.componentType());
TypeDescriptor varargsArrayType = TypeDescriptor.array(TypeDescriptor.valueOf(varargsComponentClass));
Assert.state(varargsArrayType != null, "Array type must not be null for a varargs array");
TypeDescriptor varargsComponentType = varargsArrayType.getElementTypeDescriptor();
Assert.state(varargsComponentType != null, "Component type must not be null for a varargs array");

Loading…
Cancel
Save