Skip to content

Commit a1f1619

Browse files
committed
Cleanup
1 parent e33ec33 commit a1f1619

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinAnnotationIntrospector.kt

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@ import kotlin.reflect.jvm.*
2525
import kotlin.time.Duration
2626

2727

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() {
3335

3436
// TODO: implement nullIsSameAsDefault flag, which represents when TRUE that if something has a default value, it can be passed a null to default it
3537
// 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
106108

107109
private fun AnnotatedField.hasRequiredMarker(): Boolean? {
108110
val byAnnotation = (member as Field).isRequiredByAnnotation()
109-
val byNullability = (member as Field).kotlinProperty?.returnType?.isRequired()
111+
val byNullability = (member as Field).kotlinProperty?.returnType?.isRequired()
110112

111113
return requiredAnnotationOrNullability(byAnnotation, byNullability)
112114
}
@@ -126,7 +128,7 @@ internal class KotlinAnnotationIntrospector(private val context: Module.SetupCon
126128
}
127129

128130
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
130132
}
131133

132134
// 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
180182
}
181183

182184
private fun KFunction<*>.isMethodParameterRequired(index: Int): Boolean {
183-
return isParameterRequired(index+1)
185+
return isParameterRequired(index + 1)
184186
}
185187

186188
private fun KFunction<*>.isParameterRequired(index: Int): Boolean {

0 commit comments

Comments
 (0)