Package com.google.gwt.core.client
Annotation Type UnsafeNativeLong
-
@Target(METHOD) @Retention(SOURCE) public @interface UnsafeNativeLong
This annotation can be placed on a native method to allow it to directly access Javalong
values. Without this annotation present, accessing along
in any way from a JSNI method is an error. This includes declaring a parameter or return type oflong
, calling a method that takes or returns along
, or accessing along
field.The reason for the restriction is that Java long values are not represented as numeric values in compiled code, but as opaque Objects. Attempting to perform math operations on them would produce undesirable results.
Use this annotation with care; the only safe thing to do with
long
values in JSNI code is to pass them back into Java unaltered.