diff --git a/pom.xml b/pom.xml
index 2b49bcf4..b41d8635 100644
--- a/pom.xml
+++ b/pom.xml
@@ -223,6 +223,7 @@
-->
com.fasterxml.jackson.module.kotlin.ReflectionCache
com.fasterxml.jackson.module.kotlin.TypesKt
+ com.fasterxml.jackson.module.kotlin.MissingKotlinParameterException
diff --git a/src/main/kotlin/com/fasterxml/jackson/module/kotlin/Exceptions.kt b/src/main/kotlin/com/fasterxml/jackson/module/kotlin/Exceptions.kt
index 0bca95b6..3aec2fea 100644
--- a/src/main/kotlin/com/fasterxml/jackson/module/kotlin/Exceptions.kt
+++ b/src/main/kotlin/com/fasterxml/jackson/module/kotlin/Exceptions.kt
@@ -18,7 +18,9 @@ import kotlin.reflect.KParameter
),
DeprecationLevel.WARNING
)
-class MissingKotlinParameterException(val parameter: KParameter,
+// When deserialized by the JDK, the parameter property will be null, ignoring nullability.
+// This is a temporary workaround for #572 and we will eventually remove this class.
+class MissingKotlinParameterException(@Transient val parameter: KParameter,
processor: JsonParser? = null,
msg: String) : MismatchedInputException(processor, msg) {
@Deprecated("Use main constructor", ReplaceWith("MissingKotlinParameterException(KParameter, JsonParser?, String)"))
diff --git a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/MissingKotlinParameterExceptionTest.kt b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/MissingKotlinParameterExceptionTest.kt
new file mode 100644
index 00000000..2a15fed5
--- /dev/null
+++ b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/MissingKotlinParameterExceptionTest.kt
@@ -0,0 +1,20 @@
+package com.fasterxml.jackson.module.kotlin
+
+import org.junit.Test
+import kotlin.test.assertNotNull
+import kotlin.test.assertNull
+
+class MissingKotlinParameterExceptionTest {
+ @Test
+ fun jdkSerializabilityTest() {
+ val param = ::MissingKotlinParameterException.parameters.first()
+ val ex = MissingKotlinParameterException(param, null, "test")
+
+ val serialized = jdkSerialize(ex)
+ val deserialized = jdkDeserialize(serialized)
+
+ assertNotNull(deserialized)
+ // see comment at MissingKotlinParameterException
+ assertNull(deserialized.parameter)
+ }
+}