We hit the problem while creating  our libraries.

Extending JavaScriptObject directly is not good because it restricts what
your possibilities.
So  we used composition instead, giving us more power.

So instead of

public class MyClass extends JavaScriptObject{
    protected MyClass(){
}
}

maybe you should consider something like

public class MyClass{
    protected JavaScriptObject nativePeer;

    public MyClass(){
              nativePeer =  createNativeJsoObject();
   }
}
The the public API of MyClass will delegate to the JSO.
this will give you a bit more work but the API will me more flexible and
your users will thank you :).

Cheers,

Alain



2012/9/6 Sebastián Gurin <sebastigu...@gmail.com>

> Hi all. I'm writing a lot of GWT overlay types for my new project YUIGWT -
> http://code.google.com/p/yuigwt/. I'm creating a nice and rich java
> hierarchy of overlay types there.
>
> Today I discovered that it is not good to let overlay types (extends
> JavaScriptObject implement interfaces because it seems that for a certain
> interface, no more than one overlay type can implement its methods. The
> error in question is pasted below, but this arrises a big question for me:
>
> While I understand perfectly what the error means, I would really
> appreciate if somebody can explain me the reasons behind this nasty
> restriction ? ??
>
>     [ERROR] [org.sgx.yuigwt.YuiGwtTestOnline] - Line 9: Only one
> JavaScriptObject type may implement the methods of an interface that
> declared methods. The interface (org.sgx.yuigwt.yui.yql.api.YQLQueryResult)
> is implemented by both (org.sgx.yuigwt.yui.yql.api.desc.DescResult) and
> (org.sgx.yuigwt.yui.yql.api.wheather.forecast.WheatherForecastResult)
>
> 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/-/bVE-agIAe-kJ.
> 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.
>

-- 
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