I'm trying to do this:

public interface Alert {
  public ArrayList<Alert> getOtherAlerts();
}

Client Code:

public class JSAlert extends JavaScriptObject implements Alert {

  public final native ArrayList<Alert> getOtherAlerts() /*-{
     return this.alerts;
  }-*/;

}

another class:

public void onModuleLoad() {
   JsonpRequestBuilder jsonp = new JsonpRequestBuilder();
    ...
      public void onSuccess(JsArray<JSAlert> list) {

         for (int i=0; i < list.length; i++) {
             JSAlert alert = list.get(i);
             ArrayList<Alert> more = alert.getOtherAlerts();
         }
      }

Now.. in the browser.. this works great.

But if I run this in DevMode, I get a ClassCastException that 
alert.getOtherAlerts(); is a JsArray<Alert> and can't be cast to arraylist.

Any ideas why this works in the browser.. no Js errors etc.. but in hosted 
mode/dev mode, it freaks out?

My goal, is to have a client side Javascript Overlay Type that can implement 
that same interface as a server side object.. so marshalling to/from JSON is 
made easier.. and so the server side object can have a nice basic 
java.util.ArrayList to work with.

Thanks,
Roger

-- 
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].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to