Before this CL, generated Java classes or interfaces were inner classes to the top package class. That is both unnecessary and creates ugly class names. Instead, move every generated class and interface to its own package level class. NOTE: This is a backwards incompatible change and requires every client of gomobile APIs to be updated to leave out the package class in the type names. For example, the Go type package pkg type S struct { } now generates (with the default java package name go) a Java class named go.pkg.S. The name before this CL was go.pkg.Pkg.S. Also, change the custom java package to specify the package prefix and not the full package as before. This is an unfortunate change needed to avoid name clashes between two bound packages. On the plus side, the change brings the custom package case closer to the default behaviour, which is a commen prefix, "go.", and a distinct java package for every Go package bound. Change-Id: Iadfaad56e101d1caf7e2a05006f4d384859a20fe Reviewed-on: https://go-review.googlesource.com/27436 Reviewed-by: David Crawshaw <crawshaw@golang.org>
83 lines
3.6 KiB
Plaintext
83 lines
3.6 KiB
Plaintext
// JNI functions for the Go <=> Java bridge.
|
|
// gobind -lang=java issue10788
|
|
//
|
|
// File is generated by gobind. Do not edit.
|
|
|
|
#include <android/log.h>
|
|
#include <stdint.h>
|
|
#include "seq.h"
|
|
#include "_cgo_export.h"
|
|
#include "issue10788.h"
|
|
|
|
jclass proxy_class_issue10788_TestInterface;
|
|
jmethodID proxy_class_issue10788_TestInterface_cons;
|
|
static jmethodID mid_TestInterface_DoSomeWork;
|
|
static jmethodID mid_TestInterface_MultipleUnnamedParams;
|
|
jclass proxy_class_issue10788_TestStruct;
|
|
jmethodID proxy_class_issue10788_TestStruct_cons;
|
|
|
|
JNIEXPORT void JNICALL
|
|
Java_go_issue10788_Issue10788_init(JNIEnv *env, jclass _unused) {
|
|
jclass clazz;
|
|
clazz = (*env)->FindClass(env, "go/issue10788/TestStruct");
|
|
proxy_class_issue10788_TestStruct = (*env)->NewGlobalRef(env, clazz);
|
|
proxy_class_issue10788_TestStruct_cons = (*env)->GetMethodID(env, clazz, "<init>", "(Lgo/Seq$Ref;)V");
|
|
clazz = (*env)->FindClass(env, "go/issue10788/Issue10788$proxyTestInterface");
|
|
proxy_class_issue10788_TestInterface = (*env)->NewGlobalRef(env, clazz);
|
|
proxy_class_issue10788_TestInterface_cons = (*env)->GetMethodID(env, clazz, "<init>", "(Lgo/Seq$Ref;)V");
|
|
clazz = (*env)->FindClass(env, "go/issue10788/TestInterface");
|
|
mid_TestInterface_DoSomeWork = (*env)->GetMethodID(env, clazz, "DoSomeWork", "(Lgo/issue10788/TestStruct;)V");
|
|
mid_TestInterface_MultipleUnnamedParams = (*env)->GetMethodID(env, clazz, "MultipleUnnamedParams", "(JLjava/lang/String;J)V");
|
|
|
|
}
|
|
|
|
JNIEXPORT void JNICALL
|
|
Java_go_issue10788_TestStruct_setValue(JNIEnv *env, jobject this, jstring v) {
|
|
int32_t o = go_seq_to_refnum(env, this);
|
|
nstring _v = go_seq_from_java_string(env, v);
|
|
proxyissue10788_TestStruct_Value_Set(o, _v);
|
|
}
|
|
|
|
JNIEXPORT jstring JNICALL
|
|
Java_go_issue10788_TestStruct_getValue(JNIEnv *env, jobject this) {
|
|
int32_t o = go_seq_to_refnum(env, this);
|
|
nstring r0 = proxyissue10788_TestStruct_Value_Get(o);
|
|
jstring _r0 = go_seq_to_java_string(env, r0);
|
|
return _r0;
|
|
}
|
|
|
|
JNIEXPORT void JNICALL
|
|
Java_go_issue10788_Issue10788_00024proxyTestInterface_DoSomeWork(JNIEnv* env, jobject this, jobject s) {
|
|
int32_t o = go_seq_to_refnum(env, this);
|
|
int32_t _s = go_seq_to_refnum(env, s);
|
|
proxyissue10788_TestInterface_DoSomeWork(o, _s);
|
|
}
|
|
|
|
void cproxyissue10788_TestInterface_DoSomeWork(int32_t refnum, int32_t s) {
|
|
JNIEnv *env = go_seq_push_local_frame(12);
|
|
jobject o = go_seq_from_refnum(env, refnum, proxy_class_issue10788_TestInterface, proxy_class_issue10788_TestInterface_cons);
|
|
jobject _s = go_seq_from_refnum(env, s, proxy_class_issue10788_TestStruct, proxy_class_issue10788_TestStruct_cons);
|
|
(*env)->CallVoidMethod(env, o, mid_TestInterface_DoSomeWork, _s);
|
|
go_seq_pop_local_frame(env);
|
|
}
|
|
|
|
JNIEXPORT void JNICALL
|
|
Java_go_issue10788_Issue10788_00024proxyTestInterface_MultipleUnnamedParams(JNIEnv* env, jobject this, jlong p0, jstring p1, jlong p2) {
|
|
int32_t o = go_seq_to_refnum(env, this);
|
|
nint _p0 = (nint)p0;
|
|
nstring _p1 = go_seq_from_java_string(env, p1);
|
|
int64_t _p2 = (int64_t)p2;
|
|
proxyissue10788_TestInterface_MultipleUnnamedParams(o, _p0, _p1, _p2);
|
|
}
|
|
|
|
void cproxyissue10788_TestInterface_MultipleUnnamedParams(int32_t refnum, nint p0, nstring p1, int64_t p2) {
|
|
JNIEnv *env = go_seq_push_local_frame(16);
|
|
jobject o = go_seq_from_refnum(env, refnum, proxy_class_issue10788_TestInterface, proxy_class_issue10788_TestInterface_cons);
|
|
jlong _p0 = (jlong)p0;
|
|
jstring _p1 = go_seq_to_java_string(env, p1);
|
|
jlong _p2 = (jlong)p2;
|
|
(*env)->CallVoidMethod(env, o, mid_TestInterface_MultipleUnnamedParams, _p0, _p1, _p2);
|
|
go_seq_pop_local_frame(env);
|
|
}
|
|
|