chaokunyang opened a new issue, #1966:
URL: https://github.com/apache/fury/issues/1966
### Feature Request
Kotlin support default value for fields, when deserializing, fury should
assign default value to field if serialization didn' have that field and not
write value.
For example, this is the class when serialization
```kotlin
data class Foo(val s: String)
val foo = Foo("abc")
```
And this is the class when deserialization.
```kotlin
data class Foo(val int: Int = 10, val s: String)
```
If we deserialize the data from `data class Foo(val s: String)`, we will get
`Foo(int=0, s=abc)`, but we should return `Foo(int=10, s=abc)`
### Is your feature request related to a problem? Please describe
Serialization:
```kotlin
data class Foo(val s: String )
fun main(args: Array<String>) {
val fury =
Fury.builder().requireClassRegistration(false).withCompatibleMode(CompatibleMode.COMPATIBLE).build()
Files.write(Paths.get("data"), fury.serialize(Foo(s = "abc")))
}
```
Deserialization:
```kotlin
data class Foo(val int: Int = 10, val s: String )
fun main(args: Array<String>) {
val fury =
Fury.builder().requireClassRegistration(false).withCompatibleMode(CompatibleMode.COMPATIBLE).build()
println(fury.deserialize(Files.readAllBytes(Paths.get("data"))))
// Foo(int=0, s=abc)
}
```
### Describe the solution you'd like
_No response_
### Describe alternatives you've considered
_No response_
### Additional context
_No response_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]