Skip to content

Commit 77e165b

Browse files
committed
Refactor
formatting and remove unnecessary function
1 parent 46145d8 commit 77e165b

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ internal class KotlinAnnotationIntrospector(
126126
}
127127

128128
private fun AccessibleObject.isRequiredByAnnotation(): Boolean? = annotations
129-
?.firstOrNull { it.annotationClass == JsonProperty::class }
130-
?.let { it as JsonProperty }
129+
.filterIsInstance<JsonProperty>()
130+
.firstOrNull()
131131
?.required
132132

133133
private fun requiredAnnotationOrNullability(byAnnotation: Boolean?, byNullability: Boolean?): Boolean? = when {
@@ -136,10 +136,6 @@ internal class KotlinAnnotationIntrospector(
136136
else -> byAnnotation
137137
}
138138

139-
private fun Method.isRequiredByAnnotation(): Boolean? {
140-
return (this.annotations.firstOrNull { it.annotationClass.java == JsonProperty::class.java } as? JsonProperty)?.required
141-
}
142-
143139
private fun KmProperty.isRequiredByNullability(): Boolean = !Flag.Type.IS_NULLABLE(this.returnType.flags)
144140

145141
// This could be a setter or a getter of a class property or

0 commit comments

Comments
 (0)