diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/src/main/java/com/vaadin/server/JavaScriptCallbackHelper.java | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/server/src/main/java/com/vaadin/server/JavaScriptCallbackHelper.java b/server/src/main/java/com/vaadin/server/JavaScriptCallbackHelper.java index 7e228bb7ca..7765764b47 100644 --- a/server/src/main/java/com/vaadin/server/JavaScriptCallbackHelper.java +++ b/server/src/main/java/com/vaadin/server/JavaScriptCallbackHelper.java @@ -72,12 +72,17 @@ public class JavaScriptCallbackHelper implements Serializable { private void ensureRpc() { if (javascriptCallbackRpc == null) { - javascriptCallbackRpc = (String name, JsonArray arguments) -> { - JavaScriptFunction callback = callbacks.get(name); - try { - callback.call(arguments); - } catch (JsonException e) { - throw new IllegalArgumentException(e); + // Note that javascriptCallbackRpc is not a lambda to make sure it + // can be serialized properly + javascriptCallbackRpc = new JavaScriptCallbackRpc() { + @Override + public void call(String name, JsonArray arguments) { + JavaScriptFunction callback = callbacks.get(name); + try { + callback.call(arguments); + } catch (JsonException e) { + throw new IllegalArgumentException(e); + } } }; connector.registerRpc(javascriptCallbackRpc); |