diff --git a/pom.xml b/pom.xml index c920989..85e488c 100644 --- a/pom.xml +++ b/pom.xml @@ -1,6 +1,6 @@ - 4.0.0 + 4.0.0 com.fasterxml.jackson jackson-base @@ -23,6 +23,7 @@ 1.8 2.13 2.13.3 + 1.4.21 @@ -189,7 +199,7 @@ com/fasterxml/jackson/failing/*.java - + net.alchim31.maven scala-maven-plugin @@ -211,14 +221,38 @@ + + org.jetbrains.kotlin + kotlin-maven-plugin + ${kotlin.version} + + + test-compile + + test-compile + + + + ${project.basedir}/src/test/kotlin + ${project.basedir}/src/test/java + + + + + org.apache.maven.plugins maven-compiler-plugin - compile + default-testCompile + none + + + java-test-compile + test-compile - compile + testCompile diff --git a/src/test/kotlin/com/fasterxml/jackson/integtest/kotlin/Jackson212MissingConstructorTest.kt b/src/test/kotlin/com/fasterxml/jackson/integtest/kotlin/Jackson212MissingConstructorTest.kt new file mode 100644 index 0000000..25c7edd --- /dev/null +++ b/src/test/kotlin/com/fasterxml/jackson/integtest/kotlin/Jackson212MissingConstructorTest.kt @@ -0,0 +1,27 @@ +import com.fasterxml.jackson.dataformat.xml.JacksonXmlModule +import com.fasterxml.jackson.dataformat.xml.XmlFactory +import com.fasterxml.jackson.dataformat.xml.XmlMapper +import com.fasterxml.jackson.integtest.BaseTest +import com.fasterxml.jackson.module.kotlin.registerKotlinModule +import javax.xml.stream.XMLInputFactory + +class Jackson212MissingConstructorTest : BaseTest() +{ + /** + * Succeeds in Jackson 2.11.x, but fails in Jackson 2.12.0 + * See https://github.com/FasterXML/jackson-module-kotlin/issues/396 + */ + fun testMissingConstructor() + { + val factory = XmlFactory(XMLInputFactory.newInstance()) + val mapper = XmlMapper(factory, JacksonXmlModule()).registerKotlinModule() + + val xml = "" + val product: Product = mapper.readValue(xml, Product::class.java) + + assertEquals(Product(null), product) + } + + private data class Stuff(val str: String?) + private data class Product(val stuff: Stuff?) +} \ No newline at end of file