Wednesday, March 12, 2025

Java 17 Records to serialize in GWT

Many thanks for supporting Java 17 language features

But 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 subtypes

Am 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 regards
Alex

--
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/7e10611c-5656-4ef6-b8ad-9a986db3f180n%40googlegroups.com.

No comments:

Post a Comment