Skip to content

Conversation

k163377
Copy link
Contributor

@k163377 k163377 commented May 16, 2021

findSubtypes is defined to return null if nothing can be retrieved.

https://github.com/FasterXML/jackson-databind/blob/2644cba99ec5e23ffdbe85dfe00fb471e5aa0d9c/src/main/java/com/fasterxml/jackson/databind/AnnotationIntrospector.java#L483

On the other hand, a sealed class may not have any classes to inherit from.
In this case, the conventional implementation of findSubtypes will return an empty List.

So I modified it to return null in case of an empty list.

Also, it is simpler to look at sealedSubclasses directly than to determine isSealed, so I fixed it while I was at it.

It's simpler to look at sealedSubclasses directly than to determine isSealed, so I fixed it while I was at it.
@k163377 k163377 changed the title Fix KotlinAnnotationIntrospector.findSubtypes returning wrong value in super edge cases. Fix KotlinAnnotationIntrospector.findSubtypes returning wrong value in super edge case. May 16, 2021
@dinomite dinomite merged commit 733b056 into FasterXML:2.13 May 18, 2021
@k163377 k163377 deleted the fix_findsubtypes branch May 18, 2021 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants