Skip to content

Commit

Permalink
fix kotlin support, for issue #1266
Browse files Browse the repository at this point in the history
  • Loading branch information
wenshao committed Mar 23, 2023
1 parent 658218b commit 7db03a9
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -834,13 +834,20 @@ public void getFieldInfo(BeanInfo beanInfo, FieldInfo fieldInfo, Class objectCla
});
}

if (beanInfo.kotlin && beanInfo.creatorConstructor != null && beanInfo.createParameterNames != null) {
if (beanInfo.kotlin
&& beanInfo.creatorConstructor != null
&& beanInfo.createParameterNames != null
) {
String fieldName = BeanUtils.getterName(method, null);
for (int i = 0; i < beanInfo.createParameterNames.length; i++) {
if (fieldName.equals(beanInfo.createParameterNames[i])) {
Annotation[] parameterAnnotations = beanInfo.creatorConstructor.getParameterAnnotations()[i];
processAnnotations(fieldInfo, parameterAnnotations);
break;
Annotation[][] creatorConsParamAnnotations
= beanInfo.creatorConstructor.getParameterAnnotations();
if (i < creatorConsParamAnnotations.length) {
Annotation[] parameterAnnotations = creatorConsParamAnnotations[i];
processAnnotations(fieldInfo, parameterAnnotations);
break;
}
}
}
}
Expand Down

0 comments on commit 7db03a9

Please sign in to comment.