@@ -99,16 +99,7 @@ internal class KotlinAnnotationIntrospector(private val context: Module.SetupCon
99
99
// This could be a setter or a getter of a class property or
100
100
// a setter-like/getter-like method.
101
101
private fun AnnotatedMethod.hasRequiredMarker (): Boolean? = this .getRequiredMarkerFromCorrespondingAccessor()
102
- ? : this .member.kotlinFunction?.let { method -> // Is the member method a regular method of the data class or
103
- val byAnnotation = method.javaMethod?.isRequiredByAnnotation()
104
- when {
105
- method.isGetterLike() ->
106
- requiredAnnotationOrNullability(byAnnotation, method.returnType.isRequired())
107
- method.isSetterLike() ->
108
- requiredAnnotationOrNullability(byAnnotation, method.isMethodParameterRequired(0 ))
109
- else -> null
110
- }
111
- }
102
+ ? : this .member.kotlinFunction?.getRequiredMarkerFromAccessorLikeMethod()
112
103
113
104
private fun AnnotatedMethod.getRequiredMarkerFromCorrespondingAccessor (): Boolean? {
114
105
member.declaringClass.kotlin.declaredMemberProperties.forEach { kProperty1 ->
@@ -129,6 +120,16 @@ internal class KotlinAnnotationIntrospector(private val context: Module.SetupCon
129
120
return null
130
121
}
131
122
123
+ // Is the member method a regular method of the data class or
124
+ private fun KFunction <* >.getRequiredMarkerFromAccessorLikeMethod (): Boolean? {
125
+ val byAnnotation = this .javaMethod?.isRequiredByAnnotation()
126
+ return when {
127
+ this .isGetterLike() -> requiredAnnotationOrNullability(byAnnotation, this .returnType.isRequired())
128
+ this .isSetterLike() -> requiredAnnotationOrNullability(byAnnotation, this .isMethodParameterRequired(0 ))
129
+ else -> null
130
+ }
131
+ }
132
+
132
133
private fun KFunction <* >.isGetterLike (): Boolean = parameters.size == 1
133
134
private fun KFunction <* >.isSetterLike (): Boolean =
134
135
parameters.size == 2 && returnType == Unit ::class .createType()
0 commit comments