*> Enums never need to be marked as serializable*

Apologies for my suggestion.  I'm not sure why I thought this.  I removed 
the IsSerializable from my enums that I transfer, and yep, they still work 
perfectly.

On Friday, 20 December 2024 at 12:35:19 pm UTC+11 Colin Alworth wrote:

> Can you share the full contents of Line and Box? Or at least their class 
> hierarchy and fields - methods are not important.
>
> Only fields (and inheritance) are considered for RPC serialization - a 
> method that returns a new instance won't cause that instance to be 
> serialized (since it isn't part of the object's state).
>
> Something has definitely changed since your last email - "Line$STATUS" was 
> present before, but isn't now. Was that a deliberate change?
>
> On Thursday, December 19, 2024 at 4:43:59 PM UTC-6 [email protected] 
> wrote:
>
>> > The consequence is that your enums should never ever have changing data 
>> stored
>>
>>  
>>
>> Got it.  I never modify the enum via code.  That would be a bit strange.
>>
>>  
>>
>> > Maybe Line isn't the only class that is missing in the policy file?
>>
>>  
>>
>> Yes, there are others which are missing.
>>
>>  
>>
>> > 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
>>
>>  
>>
>> I added this method to com.propfinancing.puzzle.slitherlink.Box:
>>
>>   *public* Line gwtGetLine() {
>>
>>     *return* *new* Line();
>>
>>   }
>>
>>  
>>
>> And the generated .gwt.rpc has Box, but still does not have Line:
>>
>>  
>>
>> @FinalFields, true
>>
>> *com*._3dmathpuzzles.play.client.GetPuzzleService, false, false, false, 
>> false, _, 4203465842
>>
>> *com*._3dmathpuzzles.slitherlink.RectangularWithDiagonalsPuzzle, true, 
>> true, false, false, *com*
>> ._3dmathpuzzles.slitherlink.RectangularWithDiagonalsPuzzle/2547295082 
>> <(254)%20729-5082>, 2547295082 <(254)%20729-5082>
>>
>> com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException, true, 
>> true, true, true, 
>> com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException/3936916533,
>>  
>> 3936916533
>>
>> com.google.gwt.user.client.rpc.RpcTokenException, true, true, false, 
>> false, com.google.gwt.user.client.rpc.RpcTokenException/2345075298 
>> <(234)%20507-5298>, 2345075298 <(234)%20507-5298>
>>
>> com.google.gwt.user.client.rpc.XsrfToken, false, false, true, true, 
>> com.google.gwt.user.client.rpc.XsrfToken/4254043109 <(425)%20404-3109>, 
>> 4254043109 <(425)%20404-3109>
>>
>> com.propfinancing.puzzle.Puzzle, true, false, false, false, 
>> com.propfinancing.puzzle.Puzzle/1723715424, 1723715424
>>
>> com.propfinancing.puzzle.slitherlink.Box, true, true, false, false, 
>> com.propfinancing.puzzle.slitherlink.Box/1302152982, 1302152982
>>
>> com.propfinancing.puzzle.slitherlink.Box$STATE, true, true, false, false, 
>> com.propfinancing.puzzle.slitherlink.Box$STATE/1639054469, 1639054469
>>
>> com.propfinancing.puzzle.slitherlink.BoxWithDiagonals, true, true, false, 
>> false, com.propfinancing.puzzle.slitherlink.BoxWithDiagonals/2774485663, 
>> 2774485663
>>
>> com.propfinancing.puzzle.slitherlink.Component, true, false, false, 
>> false, com.propfinancing.puzzle.slitherlink.Component/4011233562, 4011233562
>>
>> com.propfinancing.puzzle.slitherlink.NumberedBox, true, true, false, 
>> false, com.propfinancing.puzzle.slitherlink.NumberedBox/1782628205, 
>> 1782628205
>>
>> com.propfinancing.puzzle.slitherlink.Puzzle, true, false, false, false, 
>> com.propfinancing.puzzle.slitherlink.Puzzle/2584703185, 2584703185
>>
>> com.propfinancing.puzzle.slitherlink.RectangularPuzzle, true, false, 
>> false, false, com.propfinancing.puzzle.slitherlink.RectangularPuzzle/
>> 3177548746 <(317)%20754-8746>, 3177548746 <(317)%20754-8746>
>>
>> com.propfinancing.puzzle.slitherlink.RectangularWithDiagonalsPuzzle, 
>> true, false, false, false, 
>> com.propfinancing.puzzle.slitherlink.RectangularWithDiagonalsPuzzle/3793384887,
>>  
>> 3793384887
>>
>> java.lang.Exception, true, false, true, false, 
>> java.lang.Exception/1920171873, 1920171873
>>
>> java.lang.RuntimeException, true, false, true, false, 
>> java.lang.RuntimeException/515124647, 515124647
>>
>> java.lang.String, true, true, true, true, java.lang.String/2004016611, 
>> 2004016611
>>
>> java.lang.Throwable, true, false, true, false, 
>> java.lang.Throwable/2953622131, 2953622131
>>
>> java.util.ArrayList, true, true, false, false, java.util.ArrayList/
>> 4159755760 <(415)%20975-5760>, 4159755760 <(415)%20975-5760>
>>
>> java.util.HashMap, true, true, false, false, 
>> java.util.HashMap/1797211028, 1797211028
>>
>> java.util.LinkedHashMap, true, true, false, false, 
>> java.util.LinkedHashMap/3008245022, 3008245022
>>
>>  
>>
>>  
>>
>> Thank you,
>>
>>  Neil 
>>
>>  
>>
>> --
>>
>> Neil Aggarwal, (972) 834-1565, http://www.propfinancing.com
>>
>> We offer 30 year loans on single family houses!
>>
>>  
>>
>> *From:* [email protected] <[email protected]> *On 
>> Behalf Of *Jens
>> *Sent:* Thursday, December 19, 2024 3:41 PM
>> *To:* GWT Users <[email protected]>
>> *Subject:* Re: Class not included in the set of types for RPC
>>
>>  
>>
>>  
>>
>> 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 [email protected].
>> To view this discussion visit 
>> https://groups.google.com/d/msgid/google-web-toolkit/d7ee6beb-815d-44ab-8a3f-c292ee198e27n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/google-web-toolkit/d7ee6beb-815d-44ab-8a3f-c292ee198e27n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/google-web-toolkit/32f6f033-3447-44e4-a889-906bac32ad19n%40googlegroups.com.

Reply via email to