Tuesday, May 17, 2016

JsInterop funcional interfaces question

Hi all,
Why is it necessary to mark up functional interfaces in GWT2.8 with  @JsFunction. Is the standard @FunctionalInterface not enough?

My concern is that pretty soon every new GWT project (which most likely will need some forms of callbacks) would be inflicting on users code like the one below: 

/**
* I wish I did not have to do this to you, but since GWT provides nothing standard and you can not use Java 8 @FunctionalInterface ...
*/
public interface MyProjectNeedsThisAlthoughThisIsVeryCommonStuff_Sorry {
    
    @FunctionalInterface
    @JsFunction
    interface Func {//callback takes no argument
        void call();
    }

    @FunctionalInterface
    @JsFunction
    interface Func1<A> {//callback that takes 1 argument
        void call(A param1);
        
    }
}

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment