[java] Allow @:native metadata to declare JNI methods. Closes #2288