Firstly, apologies as I'm opening a duplicate thread, I already
started this (http://groups.google.com/group/google-web-toolkit/
browse_thread/thread/bb98ca98a1b853ed/
914401f7acb74e8a#914401f7acb74e8a) but because of the title II thought
it might not have grabbed peoples attention so opening this one
instead.

While playing around with the soafaces gwt project I found some
strange behaviour w.r.t. instanceof and I'm wondering has anyone
noticed anything similar before.

When sending objects from the client to the server soafaces attempts
to wrap them in an object as arrays of Serializable and IsSerializable
objects ... The method that creates the wrapper takes as an argument
of an Object (and so also Object[])

e.g.
Object[] objArray = new Object[2];
objArray[0] = new MyType1();
objArray[1] = new MyType2();
MyType1 and MyType2 both implement IsSerializable and not
Serializable

The offending code is below, the first bunch of if statements seem to
be optimisations (are we sending a single object of a certain type) ,
the last if statement is where it wraps them in a single object.

The problem is that in Hosted mode the above obj evaluates to true for
(obj instanceof Serializable) where as in my compiled and deployed
code it falls through to the final if else (that evaluates to true)
and executes correctly. Is this a bug in the hosted mode
implementation ? I'm using gwt 1.7.1 with jdk 1.6.0_16

   if (obj instanceof IsSerializable) {
      proxy._Pojo = (IsSerializable) obj;
      //Window.alert("here 1");
    } else if (obj instanceof IsSerializable[]) {
      proxy._PojoAr = (IsSerializable[]) obj;
      //Window.alert("here 2");
    } else if(obj instanceof Serializable) {
      proxy._PojoSerial = (Serializable) obj;
      //Window.alert("here 3");
    } else if (obj instanceof Serializable[]) {
      proxy._PojoSerialAr = (Serializable[]) obj;
      //Window.alert("here 4");
    } else if (obj instanceof Serializable[][]) {
      proxy._PojoSerialArAr = (Serializable[][]) obj;
      //Window.alert("here 5");
    } else if (obj instanceof JSONObject) {
      proxy._Json = ((JSONObject) obj).toString();
    } else if(obj.getClass().getName().equals("[Ljava.lang.Object;"))
{
      //Window.alert("here 6");


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to