I'm getting errors at certain points when using RPC with a class that
contains a field of type Object.* *I understand why GWT throws up an error
in this case (since the Object field could be of any type, and GWT can't
know how to serialise everything); however, if the field is changed to a
type of List<Object>, everything seems to work fine.
This is reproducible using the sample project code :
1) Create a new Web Application Project using the default project settings
(which will generate a simple Greeting project).
2) In the shared package, add a new class as follows (import and package
declarations omitted for brevity) :
public class Blah implements Serializable {
public String theString;
public Object theObject;
}
3) Add a method declaration to GreetingServiceAsync :
void breakRPC(Blah blah, AsyncCallback<Void> callback);
4) Add corresponding methods to GreetingService and GreetingServiceImpl.
5) GWT Compile the project to generate the JS. The compilation will fail
with the expected error of "In order to produce smaller client-side code,
'Object' is not allowed; please use a more specific type (reached via
Blah)".
Up to this point, I understand exactly what's going on. However, if you now
change the type of theObject to List<Object> in Blah, i.e. :
public class Blah implements Serializable {
public String theString;
public List<Object> theObject;
}
and run the GWT Compile again, the compilation runs without errors.
How does this work? Surely in both these cases GWT is attempting to
serialise Object?
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.