Monday, May 23, 2016

JsInterop @JsFunction lambda$0 is not a function in some cases


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() {
  public final ChartConfig showCurrent(CurrentFunction pFormatter) {
    showCurrent = pFormatter;
    return this;
  public final ChartConfig showCurrent() {
    showCurrent = text -> text;
    return this;
  public final ChartConfig hideCurrent() {
    showCurrent = null;
    return this;
  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();

TypeError: $wnd.Object.lambda$0 is not a function
    at HFg_g$ [as format_5_g$] (
    at Object.Joe_g$.lambda_0_g$ [as showCurrent] (
    at drawChart ((index):88)
    at oDg_g$ [as render_5_g$] (
    at RHg_g$ [as renderBrokers_0_g$] (
    at HHg_g$ [as onClusterChanged_0_g$] (
    at JHg_g$ [as onMessage_0_g$] (
    at EHg_g$ [as lambda$8_0_g$] (
    at OIg_g$ [as handleEvent_0_g$] (
    at Xli_g$ (
    at Koh_g$ (
    at WebSocket.<anonymous> (
    at qtc_g$ (
    at ttc_g$ (
    at WebSocket.<anonymous> (

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
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment