Closed peter-tackage closed 6 years ago
@tomaszpolanski I've added a test for Sound.kt
. Because there's no CREATOR
object visible in the code, I've had to let Android perform the serialization/deserialization via Bundle.
Does it work fine? I haven't tried with Kotlin 1.2, but in previous versions there was an issue parceling Date: https://stackoverflow.com/questions/46592138/nosuchmethoderror-using-parcelize-annotation-in-kotlin
@joan-domingo I have a test which uses Date
and passes. Also the Date issue in questions seems to be fixed. It's still experimental, so who knows, perhaps they could change the API or remove it. But given the simplicity of use - it's a great improvement over the old boilerplate.
@joan-domingo, @tomaszpolanski has pointed out that the test I wrote doesn't effectively test the marshalling/unmarshalling - in fact sound
and result
are the same instance, hence will always pass the equality assertion.
It's still experimental, but worth exploring because it will save 100s of LOC. Some documentation here: https://github.com/Kotlin/KEEP/blob/master/proposals/extensions/android-parcelable.md