@@ -25,11 +25,13 @@ import kotlin.reflect.jvm.*
25
25
import kotlin.time.Duration
26
26
27
27
28
- internal class KotlinAnnotationIntrospector (private val context : Module .SetupContext ,
29
- private val cache : ReflectionCache ,
30
- private val nullToEmptyCollection : Boolean ,
31
- private val nullToEmptyMap : Boolean ,
32
- private val nullIsSameAsDefault : Boolean ) : NopAnnotationIntrospector() {
28
+ internal class KotlinAnnotationIntrospector (
29
+ private val context : Module .SetupContext ,
30
+ private val cache : ReflectionCache ,
31
+ private val nullToEmptyCollection : Boolean ,
32
+ private val nullToEmptyMap : Boolean ,
33
+ private val nullIsSameAsDefault : Boolean ,
34
+ ) : NopAnnotationIntrospector() {
33
35
34
36
// TODO: implement nullIsSameAsDefault flag, which represents when TRUE that if something has a default value, it can be passed a null to default it
35
37
// this likely impacts this class to be accurate about what COULD be considered required
@@ -106,7 +108,7 @@ internal class KotlinAnnotationIntrospector(private val context: Module.SetupCon
106
108
107
109
private fun AnnotatedField.hasRequiredMarker (): Boolean? {
108
110
val byAnnotation = (member as Field ).isRequiredByAnnotation()
109
- val byNullability = (member as Field ).kotlinProperty?.returnType?.isRequired()
111
+ val byNullability = (member as Field ).kotlinProperty?.returnType?.isRequired()
110
112
111
113
return requiredAnnotationOrNullability(byAnnotation, byNullability)
112
114
}
@@ -126,7 +128,7 @@ internal class KotlinAnnotationIntrospector(private val context: Module.SetupCon
126
128
}
127
129
128
130
private fun Method.isRequiredByAnnotation (): Boolean? {
129
- return (this .annotations.firstOrNull { it.annotationClass.java == JsonProperty ::class .java } as ? JsonProperty )?.required
131
+ return (this .annotations.firstOrNull { it.annotationClass.java == JsonProperty ::class .java } as ? JsonProperty )?.required
130
132
}
131
133
132
134
// Since Kotlin's property has the same Type for each field, getter, and setter,
@@ -180,7 +182,7 @@ internal class KotlinAnnotationIntrospector(private val context: Module.SetupCon
180
182
}
181
183
182
184
private fun KFunction <* >.isMethodParameterRequired (index : Int ): Boolean {
183
- return isParameterRequired(index+ 1 )
185
+ return isParameterRequired(index + 1 )
184
186
}
185
187
186
188
private fun KFunction <* >.isParameterRequired (index : Int ): Boolean {
0 commit comments