Skip to content

Commit e8ede0a

Browse files
committed
Re-add method with deprecation note
1 parent 7f51fef commit e8ede0a

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

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

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,16 @@ import kotlin.reflect.jvm.kotlinFunction
2828

2929
internal class KotlinNamesAnnotationIntrospector(val module: KotlinModule, val cache: ReflectionCache, val ignoredClassesForImplyingJsonCreator: Set<KClass<*>>) : NopAnnotationIntrospector() {
3030
// since 2.4
31-
override fun findImplicitPropertyName(member: AnnotatedMember): String? {
32-
return when (member) {
33-
is AnnotatedMethod -> if (member.name.contains('-') && member.parameterCount == 0) {
34-
when {
35-
member.name.startsWith("get") -> member.name.substringAfter("get")
36-
member.name.startsWith("is") -> member.name.substringAfter("is")
37-
else -> null
38-
}?.replaceFirstChar { it.lowercase(Locale.getDefault()) }?.substringBefore('-')
39-
} else null
40-
is AnnotatedParameter -> findKotlinParameterName(member)
41-
else -> null
42-
}
31+
override fun findImplicitPropertyName(member: AnnotatedMember): String? = when (member) {
32+
is AnnotatedMethod -> if (member.name.contains('-') && member.parameterCount == 0) {
33+
when {
34+
member.name.startsWith("get") -> member.name.substringAfter("get")
35+
member.name.startsWith("is") -> member.name.substringAfter("is")
36+
else -> null
37+
}?.replaceFirstChar { it.lowercase(Locale.getDefault()) }?.substringBefore('-')
38+
} else null
39+
is AnnotatedParameter -> findKotlinParameterName(member)
40+
else -> null
4341
}
4442

4543
// since 2.11: support Kotlin's way of handling "isXxx" backed properties where
@@ -161,3 +159,9 @@ internal class KotlinNamesAnnotationIntrospector(val module: KotlinModule, val c
161159
}
162160
}
163161
}
162+
163+
@Deprecated(
164+
"To be removed in 2.14",
165+
ReplaceWith("with(receiver) { declaringClass.declaredMethods.any { it.name.contains('-') } }")
166+
)
167+
private fun AnnotatedMethod.isInlineClass() = declaringClass.declaredMethods.any { it.name.contains('-') }

0 commit comments

Comments
 (0)