Refine BindingReflectionHintsRegistrar Kotlin support

Closes gh-29593
This commit is contained in:
Sébastien Deleuze
2022-12-11 11:34:30 +01:00
parent dc5a773b2b
commit b27735d4a6
2 changed files with 16 additions and 1 deletions

View File

@@ -111,6 +111,8 @@ public class BindingReflectionHintsRegistrar {
if (KotlinDetector.isKotlinType(clazz)) {
KotlinDelegate.registerComponentHints(hints, clazz);
registerKotlinSerializationHints(hints, clazz);
// For Kotlin reflection
typeHint.withMembers(MemberCategory.INTROSPECT_DECLARED_METHODS);
}
});
}
@@ -192,7 +194,7 @@ public class BindingReflectionHintsRegistrar {
if (kClass.isData()) {
for (Method method : type.getMethods()) {
String methodName = method.getName();
if (methodName.startsWith("component") || methodName.equals("copy")) {
if (methodName.startsWith("component") || methodName.equals("copy") || methodName.equals("copy$default")) {
hints.registerMethod(method, ExecutableMode.INVOKE);
}
}