Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix master branch build error around Deprecation Error #815

Merged
merged 4 commits into from
Jun 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 4 additions & 27 deletions src/main/kotlin/tools/jackson/module/kotlin/KotlinModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ fun Class<*>.isKotlinClass(): Boolean = this.isAnnotationPresent(Metadata::class
* map object.
* @property nullIsSameAsDefault Default false. Whether to treat null values as absent when deserializing, thereby
* using the default value provided in Kotlin.
* @property singletonSupport Default: DISABLED. Mode for singleton handling.
* See {@link tools.jackson.module.kotlin.SingletonSupport label}
* @property enabledSingletonSupport Default: false. A temporary property that is maintained until the return value of `singletonSupport` is changed.
* It will be removed in 2.21.
* @property enabledSingletonSupport Default: false. Whether to enable singleton handling.
* @property strictNullChecks Default: false. Whether to check deserialized collections. With this disabled,
* the default, collections which are typed to disallow null members
* (e.g. List<String>) may contain null values after deserialization. Enabling it
Expand All @@ -36,27 +33,11 @@ class KotlinModule private constructor(
val nullToEmptyCollection: Boolean = NullToEmptyCollection.enabledByDefault,
val nullToEmptyMap: Boolean = NullToEmptyMap.enabledByDefault,
val nullIsSameAsDefault: Boolean = NullIsSameAsDefault.enabledByDefault,
@property:Deprecated(
level = DeprecationLevel.ERROR,
message = "The return value will be Boolean in 2.19. Until then, use enabledSingletonSupport.",
replaceWith = ReplaceWith("enabledSingletonSupport")
)
@Suppress("DEPRECATION_ERROR")
val singletonSupport: SingletonSupport = SingletonSupport.DISABLED,
val enabledSingletonSupport: Boolean = SingletonSupport.enabledByDefault,
val strictNullChecks: Boolean = StrictNullChecks.enabledByDefault,
@Deprecated(
level = DeprecationLevel.ERROR,
message = "There was a discrepancy between the property name and the Feature name." +
" To migrate to the correct property name, it will be ERROR in 2.18 and removed in 2.19.",
replaceWith = ReplaceWith("kotlinPropertyNameAsImplicitName")
)
val useKotlinPropertyNameForGetter: Boolean = KotlinPropertyNameAsImplicitName.enabledByDefault,
val kotlinPropertyNameAsImplicitName: Boolean = KotlinPropertyNameAsImplicitName.enabledByDefault,
val useJavaDurationConversion: Boolean = UseJavaDurationConversion.enabledByDefault,
) : SimpleModule(KotlinModule::class.java.name, PackageVersion.VERSION) {
@Suppress("DEPRECATION_ERROR")
val kotlinPropertyNameAsImplicitName: Boolean get() = useKotlinPropertyNameForGetter
@Suppress("DEPRECATION_ERROR")
val enabledSingletonSupport: Boolean get() = singletonSupport == SingletonSupport.CANONICALIZE

companion object {
// Increment when option is added
Expand All @@ -74,11 +55,7 @@ class KotlinModule private constructor(
builder.isEnabled(NullToEmptyCollection),
builder.isEnabled(NullToEmptyMap),
builder.isEnabled(NullIsSameAsDefault),
@Suppress("DEPRECATION_ERROR")
when {
builder.isEnabled(SingletonSupport) -> SingletonSupport.CANONICALIZE
else -> SingletonSupport.DISABLED
},
builder.isEnabled(SingletonSupport),
builder.isEnabled(StrictNullChecks),
builder.isEnabled(KotlinPropertyNameAsImplicitName),
builder.isEnabled(UseJavaDurationConversion),
Expand Down
19 changes: 0 additions & 19 deletions src/main/kotlin/tools/jackson/module/kotlin/SingletonSupport.kt

This file was deleted.