Skip to content

Commit 689e8cc

Browse files
committed
Merge remote-tracking branch 'origin/2.12' into 2.13
2 parents 06149ff + 791d854 commit 689e8cc

File tree

3 files changed

+102
-1
lines changed

3 files changed

+102
-1
lines changed

pom.xml

+33
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,39 @@
181181
<groupId>de.jjohannes</groupId>
182182
<artifactId>gradle-module-metadata-maven-plugin</artifactId>
183183
</plugin>
184+
185+
<plugin>
186+
<groupId>com.github.siom79.japicmp</groupId>
187+
<artifactId>japicmp-maven-plugin</artifactId>
188+
<version>0.15.3</version>
189+
<configuration>
190+
<oldVersion>
191+
<dependency>
192+
<groupId>com.fasterxml.jackson.module</groupId>
193+
<artifactId>jackson-module-kotlin</artifactId>
194+
<version>2.12.2</version>
195+
<type>jar</type>
196+
</dependency>
197+
</oldVersion>
198+
<newVersion>
199+
<file>
200+
<path>${project.build.directory}/${project.artifactId}-${project.version}.jar</path>
201+
</file>
202+
</newVersion>
203+
<parameter>
204+
<breakBuildOnBinaryIncompatibleModifications>true</breakBuildOnBinaryIncompatibleModifications>
205+
<breakBuildOnSourceIncompatibleModifications>true</breakBuildOnSourceIncompatibleModifications>
206+
</parameter>
207+
</configuration>
208+
<executions>
209+
<execution>
210+
<phase>verify</phase>
211+
<goals>
212+
<goal>cmp</goal>
213+
</goals>
214+
</execution>
215+
</executions>
216+
</plugin>
184217
</plugins>
185218
</build>
186219

src/test/kotlin/com/fasterxml/jackson/module/kotlin/test/github/Github80.kt

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import org.junit.Test
66
import kotlin.test.assertEquals
77

88
class TestGithub80 {
9-
109
@Test
1110
fun testIsBool() {
1211
val mapper = jacksonObjectMapper()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
package com.fasterxml.jackson.module.kotlin.test.github.failing
2+
3+
import com.fasterxml.jackson.annotation.JsonInclude
4+
import com.fasterxml.jackson.annotation.JsonProperty
5+
import com.fasterxml.jackson.databind.MapperFeature.SORT_PROPERTIES_ALPHABETICALLY
6+
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
7+
import org.junit.Ignore
8+
import org.junit.Test
9+
import kotlin.test.assertEquals
10+
11+
/**
12+
* Fields named "is…" are only serialized if they are Boolean
13+
*/
14+
class TestGitHub337 {
15+
private val mapper = jacksonObjectMapper()
16+
.setSerializationInclusion(JsonInclude.Include.ALWAYS)
17+
.configure(SORT_PROPERTIES_ALPHABETICALLY, true)
18+
private val writer = mapper.writerWithDefaultPrettyPrinter()
19+
20+
@Test
21+
@Ignore
22+
fun test_ClassWithIsFields() {
23+
data class ClassWithIsFields(
24+
val isBooleanField: Boolean,
25+
val isIntField: Int
26+
)
27+
28+
val problematic = ClassWithIsFields(true, 9)
29+
val expected = """
30+
{
31+
"isBooleanField" : true,
32+
"isIntField" : 9
33+
}""".trimIndent()
34+
assertEquals(expected, writer.writeValueAsString(problematic))
35+
}
36+
37+
@Test
38+
@Ignore
39+
fun test_AnnotatedClassWithIsFields() {
40+
data class ClassWithIsFields(
41+
@JsonProperty("isBooleanField") val isBooleanField: Boolean,
42+
@JsonProperty("isIntField") val isIntField: Int
43+
)
44+
45+
val problematic = ClassWithIsFields(true, 9)
46+
val expected = """
47+
{
48+
"isBooleanField" : true,
49+
"isIntField" : 9
50+
}""".trimIndent()
51+
assertEquals(expected, writer.writeValueAsString(problematic))
52+
}
53+
54+
@Test
55+
fun test_AnnotatedGetClassWithIsFields() {
56+
data class ClassWithIsFields(
57+
@JsonProperty("isBooleanField") val isBooleanField: Boolean,
58+
@get:JsonProperty("isIntField") val isIntField: Int
59+
)
60+
61+
val problematic = ClassWithIsFields(true, 9)
62+
val expected = """
63+
{
64+
"isBooleanField" : true,
65+
"isIntField" : 9
66+
}""".trimIndent()
67+
assertEquals(expected, writer.writeValueAsString(problematic))
68+
}
69+
}

0 commit comments

Comments
 (0)