Skip to content

Commit 863a552

Browse files
authored
Merge pull request #542 from k163377/remove_ignoredClasses
Remove meaningless checks and properties in KNAI.
2 parents 4fbe48d + baf7efa commit 863a552

File tree

5 files changed

+6
-10
lines changed

5 files changed

+6
-10
lines changed

pom.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,9 @@
271271
<exclude>com.fasterxml.jackson.module.kotlin.KotlinModule$Builder#reflectionCacheSize(int)
272272
</exclude>
273273
<!-- internal -->
274+
<exclude>
275+
com.fasterxml.jackson.module.kotlin.KotlinNamesAnnotationIntrospector#KotlinNamesAnnotationIntrospector(com.fasterxml.jackson.module.kotlin.ReflectionCache,java.util.Set,boolean)
276+
</exclude>
274277

275278
</excludes>
276279
</parameter>

release-notes/CREDITS-2.x

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Contributors:
1717

1818
# 2.18.0 (not yet released)
1919
* #782: Organize deprecated contents
20+
* #542: Remove meaningless checks and properties in KNAI
2021

2122
# 2.17.2 (not yet released)
2223

release-notes/VERSION-2.x

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Co-maintainers:
2323
#782: Content marked as deprecated has been reorganized.
2424
Several constructors and accessors to properties of KotlinModule.Builder that were marked as DeprecationLevel.ERROR have been removed.
2525
Also, the content marked as DeprecationLevel.WARNING is now DeprecationLevel.ERROR.
26+
#542: Remove meaningless checks and properties in KNAI.
2627

2728
2.17.2 (not yet released)
2829
#799: Fixed problem with code compiled with 2.17.x losing backward compatibility.

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

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,6 @@ class KotlinModule private constructor(
8989
builder.isEnabled(UseJavaDurationConversion),
9090
)
9191

92-
private val ignoredClassesForImplyingJsonCreator = emptySet<KClass<*>>()
93-
9492
override fun setupModule(context: SetupContext) {
9593
super.setupModule(context)
9694

@@ -114,12 +112,7 @@ class KotlinModule private constructor(
114112
nullIsSameAsDefault,
115113
useJavaDurationConversion
116114
))
117-
context.appendAnnotationIntrospector(
118-
KotlinNamesAnnotationIntrospector(
119-
cache,
120-
ignoredClassesForImplyingJsonCreator,
121-
kotlinPropertyNameAsImplicitName)
122-
)
115+
context.appendAnnotationIntrospector(KotlinNamesAnnotationIntrospector(cache, kotlinPropertyNameAsImplicitName))
123116

124117
context.addDeserializers(KotlinDeserializers(cache, useJavaDurationConversion))
125118
context.addKeyDeserializers(KotlinKeyDeserializers)

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import kotlin.reflect.jvm.javaType
2323

2424
internal class KotlinNamesAnnotationIntrospector(
2525
private val cache: ReflectionCache,
26-
private val ignoredClassesForImplyingJsonCreator: Set<KClass<*>>,
2726
private val useKotlinPropertyNameForGetter: Boolean
2827
) : NopAnnotationIntrospector() {
2928
private fun getterNameFromJava(member: AnnotatedMethod): String? {
@@ -89,7 +88,6 @@ internal class KotlinNamesAnnotationIntrospector(
8988
// don't add a JsonCreator to any constructor if one is declared already
9089

9190
val kClass = member.declaringClass.kotlin
92-
.apply { if (this in ignoredClassesForImplyingJsonCreator) return false }
9391
val kConstructor = cache.kotlinFromJava(member.annotated) ?: return false
9492

9593
// TODO: should we do this check or not? It could cause failures if we miss another way a property could be set

0 commit comments

Comments
 (0)