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 Java long values. Without this annotation present, accessing a long in any way from a JSNI method is an error. This includes declaring a parameter or return type of long, calling a method that takes or returns a long, or accessing a long 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.