-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Alabama 1.0.4 is not able to deserialize class object, if defaulted null fields, are not provided in JSON. For example
{
"someField":"abc",
"someNullableField":null
}Can be deserialized, but
{
"someField":"abc",
}can't.
So the bellow code will throw
import ceylon.test {
test
}
import com.github.tombentley.alabama {
deserialize
}
shared serializable
class NullableField(shared String name, shared String? id = null) {}
String json = "{\"name\":\"abc\"}";
shared test
void shouldDeserializeNullableField() {
deserialize<NullableField>(json);
}
ceylon run: lacking sufficient state for instance with id 0: value x.x.x.x::NullableField.id
ceylon.language.serialization.DeserializationException "lacking sufficient state for instance with id 0: value x.x.x.x::NullableField.id"
at ceylon.language.serialization.PartialImpl.insufficiantState(PartialImpl.java:354)
at ceylon.language.serialization.PartialImpl.initializeObject(PartialImpl.java:266)
at ceylon.language.serialization.PartialImpl.initialize(PartialImpl.java:157)
at ceylon.language.serialization.DeserializationContextImpl.reconstruct(DeserializationContextImpl.ceylon:190)
at com.github.tombentley.alabama.Deserializer.deserialize(Deserializer.ceylon:250)
at com.github.tombentley.alabama.deserialize_.deserialize(Deserializer.ceylon:652)
at com.github.tombentley.alabama.deserialize_.deserialize(Deserializer.ceylon:649)
at test.com.voitech.calcx.http.shouldDeserializeNullableField_.shouldDeserializeNullableField(TestSerialization.ceylon:18)
at x.x.x.x.shouldDeserializeNullableField_.main(TestSerialization.ceylon)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.redhat.ceylon.compiler.java.runtime.tools.impl.JavaRunnerImpl.invokeMain(JavaRunnerImpl.java:93)
at com.redhat.ceylon.compiler.java.runtime.tools.impl.JavaRunnerImpl.run(JavaRunnerImpl.java:61)
at ceylon.modules.bootstrap.CeylonRunTool.startInFlatClasspath(CeylonRunTool.java:424)
at ceylon.modules.bootstrap.CeylonRunTool.run(CeylonRunTool.java:289)
at com.redhat.ceylon.common.tools.CeylonTool.run(CeylonTool.java:547)
at com.redhat.ceylon.common.tools.CeylonTool.execute(CeylonTool.java:423)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.redhat.ceylon.launcher.Launcher.runInJava7Checked(Launcher.java:108)
at com.redhat.ceylon.launcher.Launcher.run(Launcher.java:38)
at com.redhat.ceylon.launcher.Launcher.run(Launcher.java:31)
at com.redhat.ceylon.launcher.Launcher.main(Launcher.java:24)Is it intentional ? If not, how to enable this feature.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels