Hi,
I'm having some issues with JsInterop in 2.8 snapshot. When I try to use a JsFunction I get an exception, depending on where I declare a lambda for the JsFunction.
I have a JsType defined like this:
@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object")
public class ChartConfig {
public double value;
public CurrentFunction showCurrent;
public ChartConfig() {
}
@JsOverlay
public final ChartConfig showCurrent(CurrentFunction pFormatter) {
showCurrent = pFormatter;
return this;
}
@JsOverlay
public final ChartConfig showCurrent() {
showCurrent = text -> text;
return this;
}
@JsOverlay
public final ChartConfig hideCurrent() {
showCurrent = null;
return this;
}
@JsFunction
public static interface CurrentFunction {
String format(String pValue);
}
}
When I use the first showCurrent method with a lambda everything works fine:
ChartConfig = config = new ChartConfig();
config.showCurrent( t->t);
When I use the second showCurrent method, which should be the same, I get an exception:
ChartConfig = config = new ChartConfig();
config.showCurrent();
TypeError: $wnd.Object.lambda$0 is not a function
at HFg_g$ [as format_5_g$] (ChartConfig.java:121)
at Object.Joe_g$.lambda_0_g$ [as showCurrent] (Runtime.java:161)
at drawChart ((index):88)
at oDg_g$ [as render_5_g$] (ApplicationViewImpl.java:148)
at RHg_g$ [as renderBrokers_0_g$] (MainPresenter.java:225)
at HHg_g$ [as onClusterChanged_0_g$] (MainPresenter.java:183)
at JHg_g$ [as onMessage_0_g$] (MainPresenter.java:166)
at EHg_g$ [as lambda$8_0_g$] (MainPresenter.java:133)
at OIg_g$ [as handleEvent_0_g$] (MainPresenter.java:133)
at Xli_g$ (EventListener.java:32)
at Koh_g$ (JsElementalMixinBase.java:326)
at WebSocket.<anonymous> (JsElementalMixinBase.java:271)
at qtc_g$ (Impl.java:239)
at ttc_g$ (Impl.java:291)
at WebSocket.<anonymous> (Impl.java:77)
at HFg_g$ [as format_5_g$] (ChartConfig.java:121)
at Object.Joe_g$.lambda_0_g$ [as showCurrent] (Runtime.java:161)
at drawChart ((index):88)
at oDg_g$ [as render_5_g$] (ApplicationViewImpl.java:148)
at RHg_g$ [as renderBrokers_0_g$] (MainPresenter.java:225)
at HHg_g$ [as onClusterChanged_0_g$] (MainPresenter.java:183)
at JHg_g$ [as onMessage_0_g$] (MainPresenter.java:166)
at EHg_g$ [as lambda$8_0_g$] (MainPresenter.java:133)
at OIg_g$ [as handleEvent_0_g$] (MainPresenter.java:133)
at Xli_g$ (EventListener.java:32)
at Koh_g$ (JsElementalMixinBase.java:326)
at WebSocket.<anonymous> (JsElementalMixinBase.java:271)
at qtc_g$ (Impl.java:239)
at ttc_g$ (Impl.java:291)
at WebSocket.<anonymous> (Impl.java:77)
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