|
24 | 24 | import java.util.Map; |
25 | 25 | import java.util.Optional; |
26 | 26 |
|
27 | | -import kotlin.reflect.KProperty; |
28 | | -import kotlin.reflect.jvm.ReflectJvmMapping; |
29 | 27 | import org.jspecify.annotations.Nullable; |
30 | 28 |
|
31 | 29 | import org.springframework.beans.BeansException; |
32 | 30 | import org.springframework.beans.factory.BeanFactory; |
33 | 31 | import org.springframework.beans.factory.InjectionPoint; |
34 | 32 | import org.springframework.beans.factory.NoUniqueBeanDefinitionException; |
35 | | -import org.springframework.core.KotlinDetector; |
36 | 33 | import org.springframework.core.MethodParameter; |
37 | 34 | import org.springframework.core.Nullness; |
38 | 35 | import org.springframework.core.ParameterNameDiscoverer; |
@@ -163,8 +160,7 @@ public boolean isRequired() { |
163 | 160 | } |
164 | 161 |
|
165 | 162 | if (this.field != null) { |
166 | | - return !(this.field.getType() == Optional.class || Nullness.forField(this.field) == Nullness.NULLABLE || |
167 | | - (KotlinDetector.isKotlinType(this.field.getDeclaringClass()) && KotlinDelegate.isNullable(this.field))); |
| 163 | + return !(this.field.getType() == Optional.class || Nullness.forField(this.field) == Nullness.NULLABLE); |
168 | 164 | } |
169 | 165 | else { |
170 | 166 | return !obtainMethodParameter().isOptional(); |
@@ -446,19 +442,4 @@ private void readObject(ObjectInputStream ois) throws IOException, ClassNotFound |
446 | 442 | } |
447 | 443 | } |
448 | 444 |
|
449 | | - |
450 | | - /** |
451 | | - * Inner class to avoid a hard dependency on Kotlin at runtime. |
452 | | - */ |
453 | | - private static class KotlinDelegate { |
454 | | - |
455 | | - /** |
456 | | - * Check whether the specified {@link Field} represents a nullable Kotlin type or not. |
457 | | - */ |
458 | | - public static boolean isNullable(Field field) { |
459 | | - KProperty<?> property = ReflectJvmMapping.getKotlinProperty(field); |
460 | | - return (property != null && property.getReturnType().isMarkedNullable()); |
461 | | - } |
462 | | - } |
463 | | - |
464 | 445 | } |
0 commit comments