Tuesday, July 31, 2012

call java method with generics from jsni

hi all.

Can I call a java instance method with generic parameters from jsni code ?

In my case:

public interface ArrayListCallback<T> {
boolean call(T item, int index);
}
/** ArrayList is my overlay */
public class ArrayList<T extends JavaScriptObject> extends JavaScriptObject {

public native final ArrayList<T> each(ArrayListCallback<T> c)/*-{
    var f = $entry(function(item, index){
        return c.@my.package.collection.ArrayListCallback::call(TT;I)(item, index);
    });
    return this.each(f);
}-*/;

}

my problem is with call() method calling (containing a generic type parameter). Eclipse editor autocompletes like that but it won't compile.

So my question is is it possible to do that call?

Thanks in advance.

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

No comments:

Post a Comment