Skip to content

Commit 3b490e3

Browse files
authored
Bump kx-serialization to 1.8.1 to avoid RawValue deserialization bug (#341)
1 parent 0a68338 commit 3b490e3

2 files changed

Lines changed: 48 additions & 1 deletion

File tree

buildSrc/src/main/kotlin/Dependencies.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ object Versions {
2929
const val kotlinx_collections_immutable = "0.3.5"
3030
const val kotlinx_coroutines = "1.6.4"
3131
const val kotlin_metadata = kotlin
32-
const val kotlinx_serialization = "1.8.0"
32+
const val kotlinx_serialization = "1.8.1"
3333
const val licenser = "0.6.1"
3434
const val mockk = "1.13.3"
3535
const val sarif4k = "0.5.0"

jacodb-ets/src/test/kotlin/org/jacodb/ets/test/EtsFromJsonTest.kt

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ import kotlinx.serialization.json.Json
2020
import kotlinx.serialization.json.jsonPrimitive
2121
import mu.KotlinLogging
2222
import org.jacodb.ets.dto.AnyTypeDto
23+
import org.jacodb.ets.dto.AssignStmtDto
2324
import org.jacodb.ets.dto.ClassSignatureDto
25+
import org.jacodb.ets.dto.ClosureFieldRefDto
2426
import org.jacodb.ets.dto.DecoratorDto
2527
import org.jacodb.ets.dto.FieldDto
2628
import org.jacodb.ets.dto.FieldSignatureDto
@@ -493,4 +495,49 @@ class EtsFromJsonTest {
493495
assertEquals("Cat", cls.fields[0].name)
494496
assertEquals("Dog", cls.fields[1].name)
495497
}
498+
499+
@Test
500+
fun testClosureFieldRefDto() {
501+
val s = """
502+
{
503+
"_": "ClosureFieldRef",
504+
"base": {
505+
"name": "a",
506+
"type": { "_": "UnknownType" }
507+
},
508+
"fieldName": "foo",
509+
"type": { "_": "UnknownType" }
510+
}
511+
""".trimIndent()
512+
val dto = json.decodeFromString<ValueDto>(s)
513+
logger.info { "dto = $dto" }
514+
assertIs<ClosureFieldRefDto>(dto)
515+
}
516+
517+
@Test
518+
fun testAssignArrayRefDto() {
519+
val s = """
520+
{
521+
"_": "AssignStmt",
522+
"left": {
523+
"_": "Local",
524+
"name": "x",
525+
"type": { "_": "NumberType" }
526+
},
527+
"right": {
528+
"_": "ClosureFieldRef",
529+
"base": {
530+
"name": "a",
531+
"type": { "_": "UnknownType" }
532+
},
533+
"fieldName": "foo",
534+
"type": { "_": "UnknownType" }
535+
}
536+
}
537+
""".trimIndent()
538+
val dto = json.decodeFromString<StmtDto>(s)
539+
logger.info { "dto = $dto" }
540+
assertIs<AssignStmtDto>(dto)
541+
assertIs<ClosureFieldRefDto>(dto.right)
542+
}
496543
}

0 commit comments

Comments
 (0)