From 59b9404956e1adc0680a2d503f3208398b90ab8d Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Fri, 12 Jul 2024 18:02:21 +0200 Subject: [PATCH] =?UTF-8?q?Specify=20nullability=20@=E2=81=A0Contract=20fo?= =?UTF-8?q?r=20TypeDescriptor.array()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/springframework/core/convert/TypeDescriptor.java | 1 + .../expression/spel/support/ReflectionHelper.java | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-core/src/main/java/org/springframework/core/convert/TypeDescriptor.java b/spring-core/src/main/java/org/springframework/core/convert/TypeDescriptor.java index 8c73e66fde4..522bd92b77f 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/TypeDescriptor.java +++ b/spring-core/src/main/java/org/springframework/core/convert/TypeDescriptor.java @@ -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; diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectionHelper.java b/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectionHelper.java index 5a26cfee30f..bb2c188d519 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectionHelper.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectionHelper.java @@ -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");