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

In 2.15, fixed to not be able to use Kotlin 1.4 or lower. #646

Merged
merged 3 commits into from Mar 15, 2023

Conversation

k163377
Copy link
Contributor

@k163377 k163377 commented Mar 13, 2023

SSIA

see #643 (comment)

@@ -54,6 +54,13 @@ class KotlinModule @Deprecated(
val singletonSupport: SingletonSupport = DISABLED,
val strictNullChecks: Boolean = false
) : SimpleModule(KotlinModule::class.java.name, PackageVersion.VERSION) {
init {
if (!KotlinVersion.CURRENT.isAtLeast(1, 5)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

init {
if (!KotlinVersion.CURRENT.isAtLeast(1, 5)) {
// Kotlin 1.4 was deprecated when this process was introduced(jackson-module-kotlin 2.15).
throw IllegalStateException("jackson-module-kotlin requires Kotlin 1.5 or higher.")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cowtowncoder
If there is better error message and exception, I would like to hear them.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@k163377 I think IllegalStateException sounds like a reasonable exception to use.

@pjfanning What exception does Scala module use for its checks (wrt compatible jackson-databind)? Might be useful to compare.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scala module uses JsonMappingException for this with a message like:

Scala module 2.14.1 requires Jackson Databind version >= 2.14.0 and < 2.15.0 - Found jackson-databind version 2.13.2-1

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would certainly prefer that a checked exception is used as opposed to a RuntimeException like IllegalStateException. Security 'researchers' will eventually be on the case complaining about the use of RuntimeExceptions.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I have bit mixed feelings here. Sec research will not find this unless their systems are misconfigured -- this doesn't depend on generated input but dependencies of projects -- but yeah app developers might prefer checked exceptions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pjfanning @cowtowncoder
Thanks for the review, I pushed for the change.
2a09127

@@ -65,40 +65,34 @@ internal class KotlinAnnotationIntrospector(private val context: Module.SetupCon
// Find a serializer to handle the case where the getter returns an unboxed value from the value class.
override fun findSerializer(am: Annotated): StdSerializer<*>? = when (am) {
is AnnotatedMethod -> {
when (KotlinVersion.CURRENT.isAtLeast(1, 5)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been removed as it is no longer needed once support for Kotlin 1.4 and below is removed.

@k163377 k163377 merged commit 37cfc5d into FasterXML:2.15 Mar 15, 2023
k163377 added a commit to k163377/jackson-module-kotlin that referenced this pull request Mar 15, 2023
@k163377 k163377 deleted the drop-kotlin-1.4 branch March 15, 2023 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants