bind_test.go compares the generated Go files against golden files checked in the repository. The bind package formats some of the generated Go files, so any changes in the go formatter can break the tests. This change makes the test more robust by applying formatting based on the currently used go version. Since a golden file often includes multiple go files generated by the bind, the `gofmt` function splits the golden file using the gobindPreamble marker and then run format.Source for each chunk. In order to ease the golden file splitting, this CL also moves the gobindPreamble to the beginning of each generated file consistently. It turned out bind omits formatting for some go files (generated for reverse binding). That needs to be fixed but it is a much bigger fix. Thus, in this CL, we apply the formatting on the bind's output as well. This CL also updates the gobindPreamble to follow the style guide for generated code. https://golang.org/s/generatedcode Fixes golang/go#34619 Change-Id: Ia2957693154face2848e051ebbb2373e95d79593 Reviewed-on: https://go-review.googlesource.com/c/mobile/+/198322 Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
89 lines
3.7 KiB
Plaintext
89 lines
3.7 KiB
Plaintext
// Code generated by gobind. DO NOT EDIT.
|
|
|
|
// JNI functions for the Go <=> Java bridge.
|
|
//
|
|
// autogenerated by gobind -lang=java issue10788
|
|
|
|
#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_issue10788_Issue10788__1init(JNIEnv *env, jclass _unused) {
|
|
jclass clazz;
|
|
clazz = (*env)->FindClass(env, "issue10788/TestStruct");
|
|
proxy_class_issue10788_TestStruct = (*env)->NewGlobalRef(env, clazz);
|
|
proxy_class_issue10788_TestStruct_cons = (*env)->GetMethodID(env, clazz, "<init>", "(I)V");
|
|
clazz = (*env)->FindClass(env, "issue10788/Issue10788$proxyTestInterface");
|
|
proxy_class_issue10788_TestInterface = (*env)->NewGlobalRef(env, clazz);
|
|
proxy_class_issue10788_TestInterface_cons = (*env)->GetMethodID(env, clazz, "<init>", "(I)V");
|
|
clazz = (*env)->FindClass(env, "issue10788/TestInterface");
|
|
mid_TestInterface_DoSomeWork = (*env)->GetMethodID(env, clazz, "doSomeWork", "(Lissue10788/TestStruct;)V");
|
|
mid_TestInterface_MultipleUnnamedParams = (*env)->GetMethodID(env, clazz, "multipleUnnamedParams", "(JLjava/lang/String;J)V");
|
|
|
|
}
|
|
|
|
JNIEXPORT jint JNICALL
|
|
Java_issue10788_TestStruct__1_1New(JNIEnv *env, jclass clazz) {
|
|
return new_issue10788_TestStruct();
|
|
}
|
|
|
|
JNIEXPORT void JNICALL
|
|
Java_issue10788_TestStruct_setValue(JNIEnv *env, jobject this, jstring v) {
|
|
int32_t o = go_seq_to_refnum_go(env, this);
|
|
nstring _v = go_seq_from_java_string(env, v);
|
|
proxyissue10788_TestStruct_Value_Set(o, _v);
|
|
}
|
|
|
|
JNIEXPORT jstring JNICALL
|
|
Java_issue10788_TestStruct_getValue(JNIEnv *env, jobject this) {
|
|
int32_t o = go_seq_to_refnum_go(env, this);
|
|
nstring r0 = proxyissue10788_TestStruct_Value_Get(o);
|
|
jstring _r0 = go_seq_to_java_string(env, r0);
|
|
return _r0;
|
|
}
|
|
|
|
JNIEXPORT void JNICALL
|
|
Java_issue10788_Issue10788_00024proxyTestInterface_doSomeWork(JNIEnv* env, jobject __this__, jobject s) {
|
|
int32_t o = go_seq_to_refnum_go(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(1);
|
|
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_issue10788_Issue10788_00024proxyTestInterface_multipleUnnamedParams(JNIEnv* env, jobject __this__, jlong p0, jstring p1, jlong p2) {
|
|
int32_t o = go_seq_to_refnum_go(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(3);
|
|
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);
|
|
}
|
|
|