Skip to content

Commit 7862ca0

Browse files
authored
Merge pull request #745 from k163377/fix-kotlinclass
Modified isKotlinClass determination method
2 parents 63b0819 + d4a7664 commit 7862ca0

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

release-notes/CREDITS-2.x

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Contributors:
1818
# 2.17.0 (not yet released)
1919

2020
WrongWrong (@k163377)
21+
* #745: Modified isKotlinClass determination method.
2122
* #744: API deprecation update for KotlinModule.
2223
* #743: Fix handling of vararg deserialization.
2324
* #742: Minor performance improvements to NullToEmptyCollection/Map.

release-notes/VERSION-2.x

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Co-maintainers:
1818

1919
2.17.0 (not yet released)
2020

21+
#745: Modified isKotlinClass determination method.
2122
#744: Functions that were already marked as deprecated,
2223
such as the primary constructor in KotlinModule and some functions in Builder,
2324
are scheduled for removal in 2.18 and their DeprecationLevel has been raised to Error.

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

+1-5
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,7 @@ import com.fasterxml.jackson.module.kotlin.SingletonSupport.DISABLED
1414
import java.util.*
1515
import kotlin.reflect.KClass
1616

17-
private const val metadataFqName = "kotlin.Metadata"
18-
19-
fun Class<*>.isKotlinClass(): Boolean {
20-
return declaredAnnotations.any { it.annotationClass.java.name == metadataFqName }
21-
}
17+
fun Class<*>.isKotlinClass(): Boolean = this.isAnnotationPresent(Metadata::class.java)
2218

2319
/**
2420
* @param reflectionCacheSize Default: 512. Size, in items, of the caches used for mapping objects.

0 commit comments

Comments
 (0)