Hi,

With GWT 2.1.1, I made a novice-mistake in the declaration of a
serializable object : I forgot the mandatory zero-arg constructor.
This object is used in RPC exchange between the GWT client and the
server.

In runtime I got an ugly
"com.google.gwt.user.client.rpc.SerializationException Unexpected
error..."  message.
After digging and debugging during one full day into a.o. the GWT-
generated-javascript and trying other ways to exchange my data (while
many other objects are correctly transfered to and from the
server...), I finally made a change that suddenlly produced a compiler
mesage saying explicitly that the zero-arg constructor is missing.

My question is : why in only one case the error message is produced,
and not in my all other trials ? This is very frustrating :-)

The case where the compiler produces the error message is when I
create an explicit RPC method passing explicitly the object in
parameter.

While all other cases where the compiler does not produce the error
message, are when the object is passed as a parameter of a common
method usgin a parent class param signature.

Example:

class MyBadObject extends ParentObject {
// missing zero-arg contructor
// but has constructor with arg !
...
}

class ParentObject implements Serializable { ... }

1) The case producing the compiler message:

MyService extends RemoveService {
   public void myRPCSpecificMethod(MyBadObject param);
}

2) The case where the compiler error message does not give any
message :

MyService extends RemoveService {
   public void myRPCCommonMethod(ParentObject param);
}

and the method is called with a new MyBadObject(...) param value.

A simple compiler warning message saying : "Did you forgot the zero-
arg constructor in this serializable sub-class ?" would have been very
usefull. (I am using the INFO loglevel compiler param, thus I get all
ERROR and WARN messages).

Altough I am using GWT 2.1.1, I did not see this correction in the
release notes until GWT 2.3

Thanks for your comments
Yves

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to