jsni メソッドで int 値を操作するにはどうすればよいですか?
public class Person extends JavaScriptObject{
// some other methods
public final native void setPoints(int i)/*-{
this.points= this.points + i;
}-*/;
public final native int getPoints()/*-{
return this.points;
}-*/;
}
JsArray と組み合わせたメソッドでこれを使用しています
public static boolean moreThanZeroPoints(JsArray<Person> arr, int index){
if(arr.get(index).getPoints() > 0){
return true;
}
return false;
}
ではarr.get(index).getPoints()
、次のエラー メッセージが表示されます。
uncaught: Exception caught: Exception: caught: something other than an int was returned from JSNI method.
package-path:: getPoints(): JS value of type undefined, expected int
arr.get(index).setPoints(1)
私は同じエラーメッセージを受け取ります。なにが問題ですか?助けてください。