The Java long type cannot be represented in JavaScript
as a numeric type, so GWT emulates it using an opaque data structure.
This means that JSNI methods cannot process a long as a
numeric type. The compiler therefore disallows, by default, directly
accessing a long from JSNI: JSNI methods cannot have
long as a parameter type or a return type, and they
cannot access a long using a JSNI reference. If you
find yourself wanting to pass a long into or out of a
JSNI method, here are some options:
double, use type
double instead of type long.
long
semantics, rearrange the code so that the computations happen in
Java instead of in JavaScript. That way they will use the
long emulation.
Long. There are no restrictions
on type Long with JSNI methods.
com.google.gwt.core.client.UnsafeNativeLong to the
method. The compiler will then allow you to pass a
long into and out of JavaScript. It will still be an
opaque data type, however, so the only thing you will be able to
do with it will be to pass it back to Java.