File tree Expand file tree Collapse file tree 1 file changed +7
-14
lines changed
src/main/kotlin/com/fasterxml/jackson/module/kotlin Expand file tree Collapse file tree 1 file changed +7
-14
lines changed Original file line number Diff line number Diff line change @@ -63,22 +63,15 @@ internal class KotlinAnnotationIntrospector(private val context: Module.SetupCon
63
63
* Subclasses can be detected automatically for sealed classes, since all possible subclasses are known
64
64
* at compile-time to Kotlin. This makes [com.fasterxml.jackson.annotation.JsonSubTypes] redundant.
65
65
*/
66
- override fun findSubtypes (a : Annotated ): MutableList <NamedType >? {
67
-
68
- val rawType = a.rawType
69
- if (rawType.isKotlinClass()) {
70
- val kClass = rawType.kotlin
71
- if (kClass.isSealed) {
72
- return kClass.sealedSubclasses
73
- .map { NamedType (it.java) }
74
- .toMutableList()
75
- }
66
+ override fun findSubtypes (a : Annotated ): MutableList <NamedType >? = a.rawType
67
+ .takeIf { it.isKotlinClass() }
68
+ ?.let { rawType ->
69
+ rawType.kotlin.sealedSubclasses
70
+ .map { NamedType (it.java) }
71
+ .toMutableList()
72
+ .ifEmpty { null }
76
73
}
77
74
78
- return null
79
-
80
- }
81
-
82
75
private fun AnnotatedField.hasRequiredMarker (): Boolean? {
83
76
val byAnnotation = (member as Field ).isRequiredByAnnotation()
84
77
val byNullability = (member as Field ).kotlinProperty?.returnType?.isRequired()
You can’t perform that action at this time.
0 commit comments