Note that there are some explanatory texts on larger screens.

plurals
  1. POGWT: List of enums throws "could not deserialize response"
    primarykey
    data
    text
    <p>I have a simple POJO which has some attributes, one of them being an enum. This worked fine but when I changed the enum attribute to a List of enums GWT gives me a serialization exception "could not deserialize the response". </p> <p>This works: </p> <pre><code>public class Report implements Serializable, Comparable&lt;Report&gt; { private static final long serialVersionUID = 1L; private long id; //some more attributes, all serialize fine private ReportCategory category; // the enumeration public ReportSVO(){ } //.. generated getters and setters } </code></pre> <p>When I changed the <code>private ReportCategory category;</code> to <code>private List&lt;ReportCategory&gt; categories;</code> I got the (de)serialization exception.</p> <p>Out of a hunch, I changed the enum to an inner class: (<code>public enum ReportCategory{...}</code> to <code>public class ReportCategory{ private Name categoryName; public enum Name{...}}</code>) and like magic, it works. This problem leads me to two questions:</p> <ol> <li>Is this a GWT bug? Or am I missing something?</li> <li>Is there a nicer way to solve this problem?</li> </ol> <p>The enum itself should not be a problem as it was working before (and enums are serializable by default). Also, when I forgot a no-args constructor on other GWT classes or had a non-serializable attribute the serialization exception message was like this: "com.google.gwt.user.client.rpc.SerializationException: Type '...' was not included in the set of types which can be serialized by this SerializationPolicy.."</p> <p>I am using GWT 2.4</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload