A CustomFieldSerializer must be written for a concrete class so you cannot provide a serializer for class Record and then expect to send all kinds of records. You can write your own TestRecord_CustomFieldSerializer if you want to send a record via GWT-RPC. It is the same with any other class that you define in your application that need special treatment because it does not have a default constructor. Records just allow you to write a little less code.
https://www.gwtproject.org/doc/latest/DevGuideServerCommunication.html#DevGuideCustomSerialization
-- J.
tekkyru schrieb am Mittwoch, 12. März 2025 um 19:15:06 UTC+1:
Many thanks for supporting Java 17 language featuresBut in my setup the Java records (new feature) are supported on client side but cannot be passed between server and client:public record TestRecord(String name, int age) implements IsSerializable {}
interface MyService extends RemoteService {
public TestRecord getTestRecord();
}
The GWT Code server displays an error:[ERROR] 'com.mycompany.TestRecord' has no instantiable subtypesAm I doing something wrong or the records cannot be de/serialized yet?I know they don't have the default constructors, but creating them in javascript should not be affected, and de-serializing a record instance as a call parameter can be (probably) done via reflection.Best regardsAlex
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/e86251e1-49f5-4bee-8131-c5f566cc3303n%40googlegroups.com.
No comments:
Post a Comment