diff --git a/release-notes/CREDITS-2.x b/release-notes/CREDITS-2.x index 0a75b0fb1..7e8c01e42 100644 --- a/release-notes/CREDITS-2.x +++ b/release-notes/CREDITS-2.x @@ -18,6 +18,7 @@ Contributors: # 2.17.0 (not yet released) WrongWrong (@k163377) +* #745: Modified isKotlinClass determination method. * #744: API deprecation update for KotlinModule. * #743: Fix handling of vararg deserialization. * #742: Minor performance improvements to NullToEmptyCollection/Map. diff --git a/release-notes/VERSION-2.x b/release-notes/VERSION-2.x index 1cc2da61e..b71c0f6b9 100644 --- a/release-notes/VERSION-2.x +++ b/release-notes/VERSION-2.x @@ -18,6 +18,7 @@ Co-maintainers: 2.17.0 (not yet released) +#745: Modified isKotlinClass determination method. #744: Functions that were already marked as deprecated, such as the primary constructor in KotlinModule and some functions in Builder, are scheduled for removal in 2.18 and their DeprecationLevel has been raised to Error. diff --git a/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinModule.kt b/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinModule.kt index 0e1dfee0c..8505c2c6c 100644 --- a/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinModule.kt +++ b/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinModule.kt @@ -14,11 +14,7 @@ import com.fasterxml.jackson.module.kotlin.SingletonSupport.DISABLED import java.util.* import kotlin.reflect.KClass -private const val metadataFqName = "kotlin.Metadata" - -fun Class<*>.isKotlinClass(): Boolean { - return declaredAnnotations.any { it.annotationClass.java.name == metadataFqName } -} +fun Class<*>.isKotlinClass(): Boolean = this.isAnnotationPresent(Metadata::class.java) /** * @param reflectionCacheSize Default: 512. Size, in items, of the caches used for mapping objects.