Skip to content

Commit 1a997dd

Browse files
committed
Make the primary constructor private
1 parent fcf74cd commit 1a997dd

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

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

+3-16
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import kotlin.reflect.KClass
1616
fun Class<*>.isKotlinClass(): Boolean = this.isAnnotationPresent(Metadata::class.java)
1717

1818
/**
19+
* @constructor To avoid binary compatibility issues, the primary constructor is not published.
20+
* Please use KotlinModule.Builder or extensions that use it.
1921
* @property reflectionCacheSize Default: 512. Size, in items, of the caches used for mapping objects.
2022
* @property nullToEmptyCollection Default: false. Whether to deserialize null values for collection properties as
2123
* empty collections.
@@ -36,21 +38,7 @@ fun Class<*>.isKotlinClass(): Boolean = this.isAnnotationPresent(Metadata::class
3638
* @property useJavaDurationConversion Default: false. Whether to use [java.time.Duration] as a bridge for [kotlin.time.Duration].
3739
* This allows use Kotlin Duration type with [com.fasterxml.jackson.datatype.jsr310.JavaTimeModule].
3840
*/
39-
class KotlinModule @Deprecated(
40-
level = DeprecationLevel.ERROR,
41-
message = "Use KotlinModule.Builder instead of named constructor parameters. It will be HIDDEN at 2.18.",
42-
replaceWith = ReplaceWith(
43-
"""KotlinModule.Builder()
44-
.withReflectionCacheSize(reflectionCacheSize)
45-
.configure(KotlinFeature.NullToEmptyCollection, nullToEmptyCollection)
46-
.configure(KotlinFeature.NullToEmptyMap, nullToEmptyMap)
47-
.configure(KotlinFeature.NullIsSameAsDefault, nullIsSameAsDefault)
48-
.configure(KotlinFeature.SingletonSupport, singletonSupport)
49-
.configure(KotlinFeature.StrictNullChecks, strictNullChecks)
50-
.build()""",
51-
"com.fasterxml.jackson.module.kotlin.KotlinFeature"
52-
)
53-
) constructor(
41+
class KotlinModule private constructor(
5442
val reflectionCacheSize: Int = Builder.DEFAULT_CACHE_SIZE,
5543
val nullToEmptyCollection: Boolean = NullToEmptyCollection.enabledByDefault,
5644
val nullToEmptyMap: Boolean = NullToEmptyMap.enabledByDefault,
@@ -83,7 +71,6 @@ class KotlinModule @Deprecated(
8371
level = DeprecationLevel.HIDDEN,
8472
message = "If you have no choice but to initialize KotlinModule from reflection, use this constructor."
8573
)
86-
@Suppress("DEPRECATION_ERROR")
8774
constructor() : this()
8875

8976
@Suppress("DEPRECATION_ERROR")

0 commit comments

Comments
 (0)