mirror of
https://github.com/netbirdio/gomobile-tvos-fork.git
synced 2026-05-22 18:43:29 -07:00
bind: fix field accessors for Go implemented Java classes
The go_seq_to_refnum function handles its argument object as a Java object if it doesn't implement Seq.Proxy. Java classes implemented in Go does not implement Seq.Proxy, but when passing "this" references to Go, instances must be treated as a Go object. Use go_seq_to_refnum_go everywhere "this" is passed to Go, which fixes field accessors and simplifies the method call case. Change-Id: I3d01c63d7b2081e6344ece431f5e5021a9dd7662 Reviewed-on: https://go-review.googlesource.com/31171 Reviewed-by: David Crawshaw <crawshaw@golang.org>
This commit is contained in:
Vendored
+9
-9
@@ -60,7 +60,7 @@ Java_go_structs_S__1_1New(JNIEnv *env, jclass clazz) {
|
||||
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_go_structs_S_identity(JNIEnv* env, jobject __this__) {
|
||||
int32_t o = go_seq_to_refnum(env, __this__);
|
||||
int32_t o = go_seq_to_refnum_go(env, __this__);
|
||||
struct proxystructs_S_Identity_return res = proxystructs_S_Identity(o);
|
||||
jobject _r0 = go_seq_from_refnum(env, res.r0, proxy_class_structs_S, proxy_class_structs_S_cons);
|
||||
jobject _r1 = go_seq_from_refnum(env, res.r1, proxy_class__error, proxy_class__error_cons);
|
||||
@@ -70,7 +70,7 @@ Java_go_structs_S_identity(JNIEnv* env, jobject __this__) {
|
||||
|
||||
JNIEXPORT jdouble JNICALL
|
||||
Java_go_structs_S_sum(JNIEnv* env, jobject __this__) {
|
||||
int32_t o = go_seq_to_refnum(env, __this__);
|
||||
int32_t o = go_seq_to_refnum_go(env, __this__);
|
||||
double r0 = proxystructs_S_Sum(o);
|
||||
jdouble _r0 = (jdouble)r0;
|
||||
return _r0;
|
||||
@@ -78,14 +78,14 @@ Java_go_structs_S_sum(JNIEnv* env, jobject __this__) {
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_go_structs_S_setX(JNIEnv *env, jobject this, jdouble v) {
|
||||
int32_t o = go_seq_to_refnum(env, this);
|
||||
int32_t o = go_seq_to_refnum_go(env, this);
|
||||
double _v = (double)v;
|
||||
proxystructs_S_X_Set(o, _v);
|
||||
}
|
||||
|
||||
JNIEXPORT jdouble JNICALL
|
||||
Java_go_structs_S_getX(JNIEnv *env, jobject this) {
|
||||
int32_t o = go_seq_to_refnum(env, this);
|
||||
int32_t o = go_seq_to_refnum_go(env, this);
|
||||
double r0 = proxystructs_S_X_Get(o);
|
||||
jdouble _r0 = (jdouble)r0;
|
||||
return _r0;
|
||||
@@ -93,14 +93,14 @@ Java_go_structs_S_getX(JNIEnv *env, jobject this) {
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_go_structs_S_setY(JNIEnv *env, jobject this, jdouble v) {
|
||||
int32_t o = go_seq_to_refnum(env, this);
|
||||
int32_t o = go_seq_to_refnum_go(env, this);
|
||||
double _v = (double)v;
|
||||
proxystructs_S_Y_Set(o, _v);
|
||||
}
|
||||
|
||||
JNIEXPORT jdouble JNICALL
|
||||
Java_go_structs_S_getY(JNIEnv *env, jobject this) {
|
||||
int32_t o = go_seq_to_refnum(env, this);
|
||||
int32_t o = go_seq_to_refnum_go(env, this);
|
||||
double r0 = proxystructs_S_Y_Get(o);
|
||||
jdouble _r0 = (jdouble)r0;
|
||||
return _r0;
|
||||
@@ -114,13 +114,13 @@ Java_go_structs_S2__1_1New(JNIEnv *env, jclass clazz) {
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_go_structs_S2_m(JNIEnv* env, jobject __this__) {
|
||||
int32_t o = go_seq_to_refnum(env, __this__);
|
||||
int32_t o = go_seq_to_refnum_go(env, __this__);
|
||||
proxystructs_S2_M(o);
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_go_structs_S2_string(JNIEnv* env, jobject __this__) {
|
||||
int32_t o = go_seq_to_refnum(env, __this__);
|
||||
int32_t o = go_seq_to_refnum_go(env, __this__);
|
||||
nstring r0 = proxystructs_S2_String(o);
|
||||
jstring _r0 = go_seq_to_java_string(env, r0);
|
||||
return _r0;
|
||||
@@ -128,7 +128,7 @@ Java_go_structs_S2_string(JNIEnv* env, jobject __this__) {
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_go_structs_Structs_00024proxyI_m(JNIEnv* env, jobject __this__) {
|
||||
int32_t o = go_seq_to_refnum(env, __this__);
|
||||
int32_t o = go_seq_to_refnum_go(env, __this__);
|
||||
proxystructs_I_M(o);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user