Merge branch '3.0.x'

Closes gh-34611
This commit is contained in:
Phillip Webb
2023-03-14 18:04:39 -07:00

View File

@@ -21,8 +21,6 @@ import java.lang.reflect.Modifier;
import java.util.Arrays;
import java.util.stream.Stream;
import kotlin.jvm.JvmClassMappingKt;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.KotlinDetector;
@@ -106,7 +104,7 @@ class DefaultBindConstructorProvider implements BindConstructorProvider {
MergedAnnotations[] candidateAnnotations = getAnnotations(candidates);
boolean kotlinType = isKotlinType(type);
boolean deducedBindConstructor = false;
boolean immutableType = type.isRecord() || isKotlinDataClass(type);
boolean immutableType = type.isRecord();
Constructor<?> bind = getConstructorBindingAnnotated(type, candidates, candidateAnnotations);
if (bind == null && !hasAutowiredConstructor) {
bind = deduceBindConstructor(type, candidates);
@@ -198,10 +196,6 @@ class DefaultBindConstructorProvider implements BindConstructorProvider {
return (result != null && result.getParameterCount() > 0) ? result : null;
}
private static boolean isKotlinDataClass(Class<?> type) {
return isKotlinType(type) && JvmClassMappingKt.getKotlinClass(type).isData();
}
private static boolean isKotlinType(Class<?> type) {
return KotlinDetector.isKotlinPresent() && KotlinDetector.isKotlinType(type);
}