Thursday, December 19, 2024

Re: Class not included in the set of types for RPC

Improving the explanation of why Line isn't present would require exhaustively listing all the possible fields/etc that where is _isn't_ valid to assign a Line instance - Line isnt a subtype of String, Line isn't a subtype of List, the List in this field is List<Component> and Line isn't a subtype of Component, etc...

If you can point out in code how you expect to be able to send the Line type (which field in which other type that _is_ present in that list) it would be easier to offer an explanation.

On Thursday, December 19, 2024 at 3:41:11 PM UTC-6 Jens wrote:
Neil Aggarwal schrieb am Donnerstag, 19. Dezember 2024 um 17:12:06 UTC+1:

> Enumeration constants are serialized as a name only; none of the field values are serialized.

What are the consequences of not having the values?

The consequence is that your enums should never ever have changing data stored. For example MyEnum.PERSON.getFriends().add(friend) is possible in Java but makes the enum constant mutable, which is bad. If enum constants are immutable then serializing the name or ordinal is enough to reconstruct the state.

> Can you confirm that the policy file does include Line

It does not have Line in it:

Does Line satisfy all rules? Default constructor, implements Serializable and only has Serializable fields? If yes, take a look at your GWT-RPC service method(s) declaration. Starting from the return type and the parameter types of the GWT-RPC method(s), will Line be discoverable directly or is it hidden behind some interface or super class or possibly class Object and GWT would need to find all the candidates that match these interfaces/super classes? If Line is hidden, do the interface / super class follow the rules? Maybe Line isn't the only class that is missing in the policy file?

As a workaround you can always add dummy methods to your GWT-RPC service, e.g. Line getDummyLine(), to make a class visible to GWT (or a Dummy class with a Line field and then use Dummy as return type).

-- J.


--
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/e8ea5002-eb62-45e9-a187-54937300fd03n%40googlegroups.com.

No comments:

Post a Comment