The native method returns always a Double for numbers which causes a casting exception in these cases:
int i = js.get("key");

But looking into the code now I think the native method should be private and have a name like getImpl to avoid the compiler has to select the most appropriate signature.