bind: use lowercase method names for Java binds

There was a discussion a year ago about making methods and types
lowercase in ObjC (https://github.com/golang/go/issues/12889),
which was done (https://go-review.googlesource.com/#/c/15780/),
alas the suggested Java lower casing was never addressed.

This CL converts all generated Java methods to lower case.

Change-Id: Ia2f28519bc59362877881636109ddfc651b24960
Reviewed-on: https://go-review.googlesource.com/28494
Reviewed-by: Elias Naur <elias.naur@gmail.com>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
This commit is contained in:
Péter Szilágyi
2016-09-07 12:52:06 +00:00
committed by Elias Naur
parent f7e06c9519
commit 2f75be449f
35 changed files with 2990 additions and 282 deletions
+1
View File
@@ -31,6 +31,7 @@ var tests = []string{
"testdata/issue10788.go",
"testdata/issue12328.go",
"testdata/issue12403.go",
"testdata/keywords.go",
"testdata/try.go",
"testdata/vars.go",
"testdata/ignore.go",
+51 -30
View File
@@ -147,7 +147,7 @@ func (g *JavaGen) genStruct(obj *types.TypeName, T *types.Struct) {
g.Printf("@Override public String toString() {\n")
g.Indent()
if isStringer {
g.Printf("return String();\n")
g.Printf("return string();\n")
} else {
g.Printf("StringBuilder b = new StringBuilder();\n")
g.Printf(`b.append("%s").append("{");`, obj.Name())
@@ -375,7 +375,11 @@ func (g *JavaGen) genJNIFuncSignature(o *types.Func, sName string, proxy bool) {
} else {
g.Printf(g.className())
}
g.Printf("_%s(JNIEnv* env, ", o.Name())
oName := javaNameReplacer.Replace(lowerFirst(o.Name()))
if strings.HasSuffix(oName, "_") {
oName += "1" // JNI doesn't like methods ending with underscore, needs the _1 suffixing
}
g.Printf("_%s(JNIEnv* env, ", oName)
if sName != "" {
g.Printf("jobject this")
} else {
@@ -431,8 +435,7 @@ func (g *JavaGen) genFuncSignature(o *types.Func, static, header bool) {
if !header {
g.Printf("native ")
}
oName := o.Name()
g.Printf("%s %s(", ret, oName)
g.Printf("%s %s(", ret, javaNameReplacer.Replace(lowerFirst(o.Name())))
params := sig.Params()
for i := 0; i < params.Len(); i++ {
if i > 0 {
@@ -561,33 +564,51 @@ func (g *JavaGen) gobindOpts() string {
return strings.Join(opts, " ")
}
var javaNameReplacer = strings.NewReplacer(
"-", "_",
".", "_",
)
var javaKeywordsAndReserves = []string{
"abstract", "assert", "boolean", "break", "byte", "case", "catch", "char",
"class", "const", "continue", "default", "do", "double", "else", "enum",
"extends", "final", "finally", "float", "for", "goto", "if", "implements",
"import", "instanceof", "int", "interface", "long", "native", "new", "package",
"private", "protected", "public", "return", "short", "static", "strictfp",
"super", "switch", "synchronized", "this", "throw", "throws", "transient",
"try", "void", "volatile", "while", "false", "null", "true"}
// javaNameSanitizer replaces all dashes and dots with underscores, as well as
// avoiding all keywords and reserved words by suffixing such identifier with
// an underscore.
type javaNameSanitizer struct {
symbols *strings.Replacer
reserved map[string]bool
}
func newJavaNameSanitizer() *javaNameSanitizer {
reserved := make(map[string]bool)
for _, word := range javaKeywordsAndReserves {
reserved[word] = true
}
return &javaNameSanitizer{
symbols: strings.NewReplacer(
"-", "_",
".", "_",
),
reserved: reserved,
}
}
func (r *javaNameSanitizer) Replace(s string) string {
if r.reserved[s] {
return s + "_"
}
return r.symbols.Replace(s)
}
var javaNameReplacer = newJavaNameSanitizer()
func (g *JavaGen) javaPkgName(pkg *types.Package) string {
if pkg == nil {
return "go"
}
s := javaNameReplacer.Replace(pkg.Name())
// Look for Java keywords that are not Go keywords, and avoid using
// them as a package name.
//
// This is not a problem for normal Go identifiers as we only expose
// exported symbols. The upper case first letter saves everything
// from accidentally matching except for the package name.
//
// Note that basic type names (like int) are not keywords in Go.
switch s {
case "abstract", "assert", "boolean", "byte", "catch", "char", "class",
"do", "double", "enum", "extends", "final", "finally", "float",
"implements", "instanceof", "int", "long", "native", "private",
"protected", "public", "short", "static", "strictfp", "super",
"synchronized", "this", "throw", "throws", "transient", "try",
"void", "volatile", "while":
s += "_"
}
if g.JavaPkg != "" {
return g.JavaPkg + "." + s
} else {
@@ -603,7 +624,7 @@ func className(pkg *types.Package) string {
if pkg == nil {
return "Universe"
}
return strings.Title(javaNameReplacer.Replace(pkg.Name()))
return javaNameReplacer.Replace(strings.Title(pkg.Name()))
}
func (g *JavaGen) genConst(o *types.Const) {
@@ -994,7 +1015,7 @@ func (g *JavaGen) GenC() error {
}
g.Printf("\n")
g.Printf("JNIEXPORT void JNICALL\n")
g.Printf("Java_%s_%s_init(JNIEnv *env, jclass _unused) {\n", g.jniPkgName(), g.className())
g.Printf("Java_%s_%s__1init(JNIEnv *env, jclass _unused) {\n", g.jniPkgName(), g.className())
g.Indent()
g.Printf("jclass clazz;\n")
for _, s := range g.structs {
@@ -1027,7 +1048,7 @@ func (g *JavaGen) GenC() error {
jniParams += g.jniSigType(params.At(i).Type())
}
g.Printf("mid_%s_%s = (*env)->GetMethodID(env, clazz, %q, \"(%s)%s\");\n",
iface.obj.Name(), m.Name(), m.Name(), jniParams, retSig)
iface.obj.Name(), m.Name(), javaNameReplacer.Replace(lowerFirst(m.Name())), jniParams, retSig)
}
g.Printf("\n")
}
@@ -1079,13 +1100,13 @@ func (g *JavaGen) GenJava() error {
}
}
}
g.Printf("init();\n")
g.Printf("_init();\n")
g.Outdent()
g.Printf("}\n\n")
g.Printf("private %s() {} // uninstantiable\n\n", g.className())
g.Printf("// touch is called from other bound packages to initialize this package\n")
g.Printf("public static void touch() {}\n\n")
g.Printf("private static native void init();\n\n")
g.Printf("private static native void _init();\n\n")
for _, iface := range g.interfaces {
g.Printf(javaProxyPreamble, iface.obj.Name())
+1 -1
View File
@@ -10,6 +10,6 @@ import org.golang.custompkg.testpkg.Testpkg;
public class CustomPkgTest extends InstrumentationTestCase {
public void testHi() {
Testpkg.Hi();
Testpkg.hi();
}
}
+2 -2
View File
@@ -49,12 +49,12 @@ public class Seq {
}
private static void throwException(error err) throws Exception {
throw new Exception(err.Error());
throw new Exception(err.error());
}
private static error wrapThrowable(final Throwable t) {
return new error() {
@Override public String Error() {
@Override public String error() {
return t.getMessage();
}
};
+29 -29
View File
@@ -18,7 +18,7 @@ import go.benchmark.*;
public class SeqBench extends InstrumentationTestCase {
public static class AnI implements I {
@Override public void F() {
@Override public void f() {
}
}
@@ -34,81 +34,81 @@ public class SeqBench extends InstrumentationTestCase {
});
benchmarks.put("Noargs", new Runnable() {
@Override public void run() {
Benchmark.Noargs();
Benchmark.noargs();
}
});
benchmarks.put("Onearg", new Runnable() {
@Override public void run() {
Benchmark.Onearg(0);
Benchmark.onearg(0);
}
});
benchmarks.put("Manyargs", new Runnable() {
@Override public void run() {
Benchmark.Manyargs(0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
Benchmark.manyargs(0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
}
});
benchmarks.put("Oneret", new Runnable() {
@Override public void run() {
Benchmark.Oneret();
Benchmark.oneret();
}
});
final I javaRef = new AnI();
benchmarks.put("Refforeign", new Runnable() {
@Override public void run() {
Benchmark.Ref(javaRef);
Benchmark.ref(javaRef);
}
});
final I goRef = Benchmark.NewI();
final I goRef = Benchmark.newI();
benchmarks.put("Refgo", new Runnable() {
@Override public void run() {
Benchmark.Ref(goRef);
Benchmark.ref(goRef);
}
});
benchmarks.put("StringShort", new Runnable() {
@Override public void run() {
Benchmark.String(Benchmark.ShortString);
Benchmark.string(Benchmark.ShortString);
}
});
benchmarks.put("StringLong", new Runnable() {
@Override public void run() {
Benchmark.String(Benchmark.LongString);
Benchmark.string(Benchmark.LongString);
}
});
benchmarks.put("StringShortUnicode", new Runnable() {
@Override public void run() {
Benchmark.String(Benchmark.ShortStringUnicode);
Benchmark.string(Benchmark.ShortStringUnicode);
}
});
benchmarks.put("StringLongUnicode", new Runnable() {
@Override public void run() {
Benchmark.String(Benchmark.LongStringUnicode);
Benchmark.string(Benchmark.LongStringUnicode);
}
});
benchmarks.put("StringRetShort", new Runnable() {
@Override public void run() {
Benchmark.StringRetShort();
Benchmark.stringRetShort();
}
});
benchmarks.put("StringRetLong", new Runnable() {
@Override public void run() {
Benchmark.StringRetLong();
Benchmark.stringRetLong();
}
});
final byte[] shortSlice = Benchmark.getShortSlice();
benchmarks.put("SliceShort", new Runnable() {
@Override public void run() {
Benchmark.Slice(shortSlice);
Benchmark.slice(shortSlice);
}
});
final byte[] longSlice = Benchmark.getLongSlice();
benchmarks.put("SliceLong", new Runnable() {
@Override public void run() {
Benchmark.Slice(longSlice);
Benchmark.slice(longSlice);
}
});
}
public void RunDirect(String name, final long n) {
public void runDirect(String name, final long n) {
final Runnable r = benchmarks.get(name);
try {
executor.submit(new Runnable() {
@@ -123,40 +123,40 @@ public class SeqBench extends InstrumentationTestCase {
}
}
public void Run(String name, long n) {
public void run(String name, long n) {
final Runnable r = benchmarks.get(name);
for (int i = 0; i < n; i++) {
r.run();
}
}
@Override public I NewI() {
@Override public I newI() {
return new AnI();
}
@Override public void Ref(I i) {
@Override public void ref(I i) {
}
@Override public void Noargs() {
@Override public void noargs() {
}
@Override public void Onearg(long i) {
@Override public void onearg(long i) {
}
@Override public long Oneret() {
@Override public long oneret() {
return 0;
}
@Override public void Manyargs(long p0, long p1, long p2, long p3, long p4, long p5, long p6, long p7, long gp8, long p9) {
@Override public void manyargs(long p0, long p1, long p2, long p3, long p4, long p5, long p6, long p7, long gp8, long p9) {
}
@Override public void String(String s) {
@Override public void string(String s) {
}
@Override public void Slice(byte[] s) {
@Override public void slice(byte[] s) {
}
@Override public String StringRetShort() {
@Override public String stringRetShort() {
return Benchmark.ShortString;
}
@Override public String StringRetLong() {
@Override public String stringRetLong() {
return Benchmark.LongString;
}
}
public void testBenchmark() {
Benchmark.RunBenchmarks(new Benchmarks());
Benchmark.runBenchmarks(new Benchmarks());
}
}
+108 -101
View File
File diff suppressed because it is too large Load Diff
+6 -6
View File
@@ -11,12 +11,12 @@
JNIEXPORT void JNICALL
Java_go_basictypes_Basictypes_init(JNIEnv *env, jclass _unused) {
Java_go_basictypes_Basictypes__1init(JNIEnv *env, jclass _unused) {
jclass clazz;
}
JNIEXPORT jboolean JNICALL
Java_go_basictypes_Basictypes_Bool(JNIEnv* env, jclass clazz, jboolean p0) {
Java_go_basictypes_Basictypes_bool(JNIEnv* env, jclass clazz, jboolean p0) {
char _p0 = (char)p0;
char r0 = proxybasictypes__Bool(_p0);
jboolean _r0 = r0 ? JNI_TRUE : JNI_FALSE;
@@ -24,7 +24,7 @@ Java_go_basictypes_Basictypes_Bool(JNIEnv* env, jclass clazz, jboolean p0) {
}
JNIEXPORT jbyteArray JNICALL
Java_go_basictypes_Basictypes_ByteArrays(JNIEnv* env, jclass clazz, jbyteArray x) {
Java_go_basictypes_Basictypes_byteArrays(JNIEnv* env, jclass clazz, jbyteArray x) {
nbyteslice _x = go_seq_from_java_bytearray(env, x, 0);
nbyteslice r0 = proxybasictypes__ByteArrays(_x);
if (_x.ptr != NULL) {
@@ -35,14 +35,14 @@ Java_go_basictypes_Basictypes_ByteArrays(JNIEnv* env, jclass clazz, jbyteArray x
}
JNIEXPORT void JNICALL
Java_go_basictypes_Basictypes_Error(JNIEnv* env, jclass clazz) {
Java_go_basictypes_Basictypes_error(JNIEnv* env, jclass clazz) {
int32_t r0 = proxybasictypes__Error();
jobject _r0 = go_seq_from_refnum(env, r0, proxy_class__error, proxy_class__error_cons);
go_seq_maybe_throw_exception(env, _r0);
}
JNIEXPORT jlong JNICALL
Java_go_basictypes_Basictypes_ErrorPair(JNIEnv* env, jclass clazz) {
Java_go_basictypes_Basictypes_errorPair(JNIEnv* env, jclass clazz) {
struct proxybasictypes__ErrorPair_return res = proxybasictypes__ErrorPair();
jlong _r0 = (jlong)res.r0;
jobject _r1 = go_seq_from_refnum(env, res.r1, proxy_class__error, proxy_class__error_cons);
@@ -51,7 +51,7 @@ Java_go_basictypes_Basictypes_ErrorPair(JNIEnv* env, jclass clazz) {
}
JNIEXPORT void JNICALL
Java_go_basictypes_Basictypes_Ints(JNIEnv* env, jclass clazz, jbyte x, jshort y, jint z, jlong t, jlong u) {
Java_go_basictypes_Basictypes_ints(JNIEnv* env, jclass clazz, jbyte x, jshort y, jint z, jlong t, jlong u) {
int8_t _x = (int8_t)x;
int16_t _y = (int16_t)y;
int32_t _z = (int32_t)z;
+7 -7
View File
@@ -9,7 +9,7 @@ import go.Seq;
public abstract class Basictypes {
static {
Seq.touch(); // for loading the native library
init();
_init();
}
private Basictypes() {} // uninstantiable
@@ -17,7 +17,7 @@ public abstract class Basictypes {
// touch is called from other bound packages to initialize this package
public static void touch() {}
private static native void init();
private static native void _init();
public static final boolean ABool = true;
@@ -28,9 +28,9 @@ public abstract class Basictypes {
public static final long AnInt = 7L;
public static final long AnInt2 = 9223372036854775807L;
public static native boolean Bool(boolean p0);
public static native byte[] ByteArrays(byte[] x);
public static native void Error() throws Exception;
public static native long ErrorPair() throws Exception;
public static native void Ints(byte x, short y, int z, long t, long u);
public static native boolean bool(boolean p0);
public static native byte[] byteArrays(byte[] x);
public static native void error() throws Exception;
public static native long errorPair() throws Exception;
public static native void ints(byte x, short y, int z, long t, long u);
}
+2 -2
View File
@@ -11,12 +11,12 @@
JNIEXPORT void JNICALL
Java_com_example_customprefix_Customprefix_init(JNIEnv *env, jclass _unused) {
Java_com_example_customprefix_Customprefix__1init(JNIEnv *env, jclass _unused) {
jclass clazz;
}
JNIEXPORT void JNICALL
Java_com_example_customprefix_Customprefix_F(JNIEnv* env, jclass clazz) {
Java_com_example_customprefix_Customprefix_f(JNIEnv* env, jclass clazz) {
proxycustomprefix__F();
}
+3 -3
View File
@@ -9,7 +9,7 @@ import go.Seq;
public abstract class Customprefix {
static {
Seq.touch(); // for loading the native library
init();
_init();
}
private Customprefix() {} // uninstantiable
@@ -17,9 +17,9 @@ public abstract class Customprefix {
// touch is called from other bound packages to initialize this package
public static void touch() {}
private static native void init();
private static native void _init();
public static native void F();
public static native void f();
}
+1 -1
View File
@@ -19,7 +19,7 @@ jclass proxy_class_ignore_S;
jmethodID proxy_class_ignore_S_cons;
JNIEXPORT void JNICALL
Java_go_ignore_Ignore_init(JNIEnv *env, jclass _unused) {
Java_go_ignore_Ignore__1init(JNIEnv *env, jclass _unused) {
jclass clazz;
clazz = (*env)->FindClass(env, "go/ignore/S");
proxy_class_ignore_S = (*env)->NewGlobalRef(env, clazz);
+2 -2
View File
@@ -63,7 +63,7 @@ import go.Seq;
public abstract class Ignore {
static {
Seq.touch(); // for loading the native library
init();
_init();
}
private Ignore() {} // uninstantiable
@@ -71,7 +71,7 @@ public abstract class Ignore {
// touch is called from other bound packages to initialize this package
public static void touch() {}
private static native void init();
private static native void _init();
private static final class proxyI extends Seq.Proxy implements I {
proxyI(Seq.Ref ref) { super(ref); }
+22 -22
View File
@@ -36,61 +36,61 @@ jmethodID proxy_class_interfaces_WithParam_cons;
static jmethodID mid_WithParam_HasParam;
JNIEXPORT void JNICALL
Java_go_interfaces_Interfaces_init(JNIEnv *env, jclass _unused) {
Java_go_interfaces_Interfaces__1init(JNIEnv *env, jclass _unused) {
jclass clazz;
clazz = (*env)->FindClass(env, "go/interfaces/Interfaces$proxyError");
proxy_class_interfaces_Error = (*env)->NewGlobalRef(env, clazz);
proxy_class_interfaces_Error_cons = (*env)->GetMethodID(env, clazz, "<init>", "(Lgo/Seq$Ref;)V");
clazz = (*env)->FindClass(env, "go/interfaces/Error");
mid_Error_Err = (*env)->GetMethodID(env, clazz, "Err", "()V");
mid_Error_Err = (*env)->GetMethodID(env, clazz, "err", "()V");
clazz = (*env)->FindClass(env, "go/interfaces/Interfaces$proxyI");
proxy_class_interfaces_I = (*env)->NewGlobalRef(env, clazz);
proxy_class_interfaces_I_cons = (*env)->GetMethodID(env, clazz, "<init>", "(Lgo/Seq$Ref;)V");
clazz = (*env)->FindClass(env, "go/interfaces/I");
mid_I_Rand = (*env)->GetMethodID(env, clazz, "Rand", "()I");
mid_I_Rand = (*env)->GetMethodID(env, clazz, "rand", "()I");
clazz = (*env)->FindClass(env, "go/interfaces/Interfaces$proxyI1");
proxy_class_interfaces_I1 = (*env)->NewGlobalRef(env, clazz);
proxy_class_interfaces_I1_cons = (*env)->GetMethodID(env, clazz, "<init>", "(Lgo/Seq$Ref;)V");
clazz = (*env)->FindClass(env, "go/interfaces/I1");
mid_I1_J = (*env)->GetMethodID(env, clazz, "J", "()V");
mid_I1_J = (*env)->GetMethodID(env, clazz, "j", "()V");
clazz = (*env)->FindClass(env, "go/interfaces/Interfaces$proxyI2");
proxy_class_interfaces_I2 = (*env)->NewGlobalRef(env, clazz);
proxy_class_interfaces_I2_cons = (*env)->GetMethodID(env, clazz, "<init>", "(Lgo/Seq$Ref;)V");
clazz = (*env)->FindClass(env, "go/interfaces/I2");
mid_I2_G = (*env)->GetMethodID(env, clazz, "G", "()V");
mid_I2_G = (*env)->GetMethodID(env, clazz, "g", "()V");
clazz = (*env)->FindClass(env, "go/interfaces/Interfaces$proxyI3");
proxy_class_interfaces_I3 = (*env)->NewGlobalRef(env, clazz);
proxy_class_interfaces_I3_cons = (*env)->GetMethodID(env, clazz, "<init>", "(Lgo/Seq$Ref;)V");
clazz = (*env)->FindClass(env, "go/interfaces/I3");
mid_I3_F = (*env)->GetMethodID(env, clazz, "F", "()Lgo/interfaces/I1;");
mid_I3_F = (*env)->GetMethodID(env, clazz, "f", "()Lgo/interfaces/I1;");
clazz = (*env)->FindClass(env, "go/interfaces/Interfaces$proxyLargerI");
proxy_class_interfaces_LargerI = (*env)->NewGlobalRef(env, clazz);
proxy_class_interfaces_LargerI_cons = (*env)->GetMethodID(env, clazz, "<init>", "(Lgo/Seq$Ref;)V");
clazz = (*env)->FindClass(env, "go/interfaces/LargerI");
mid_LargerI_AnotherFunc = (*env)->GetMethodID(env, clazz, "AnotherFunc", "()V");
mid_LargerI_Rand = (*env)->GetMethodID(env, clazz, "Rand", "()I");
mid_LargerI_AnotherFunc = (*env)->GetMethodID(env, clazz, "anotherFunc", "()V");
mid_LargerI_Rand = (*env)->GetMethodID(env, clazz, "rand", "()I");
clazz = (*env)->FindClass(env, "go/interfaces/Interfaces$proxySameI");
proxy_class_interfaces_SameI = (*env)->NewGlobalRef(env, clazz);
proxy_class_interfaces_SameI_cons = (*env)->GetMethodID(env, clazz, "<init>", "(Lgo/Seq$Ref;)V");
clazz = (*env)->FindClass(env, "go/interfaces/SameI");
mid_SameI_Rand = (*env)->GetMethodID(env, clazz, "Rand", "()I");
mid_SameI_Rand = (*env)->GetMethodID(env, clazz, "rand", "()I");
clazz = (*env)->FindClass(env, "go/interfaces/Interfaces$proxyWithParam");
proxy_class_interfaces_WithParam = (*env)->NewGlobalRef(env, clazz);
proxy_class_interfaces_WithParam_cons = (*env)->GetMethodID(env, clazz, "<init>", "(Lgo/Seq$Ref;)V");
clazz = (*env)->FindClass(env, "go/interfaces/WithParam");
mid_WithParam_HasParam = (*env)->GetMethodID(env, clazz, "HasParam", "(Z)V");
mid_WithParam_HasParam = (*env)->GetMethodID(env, clazz, "hasParam", "(Z)V");
}
JNIEXPORT jint JNICALL
Java_go_interfaces_Interfaces_Add3(JNIEnv* env, jclass clazz, jobject r) {
Java_go_interfaces_Interfaces_add3(JNIEnv* env, jclass clazz, jobject r) {
int32_t _r = go_seq_to_refnum(env, r);
int32_t r0 = proxyinterfaces__Add3(_r);
jint _r0 = (jint)r0;
@@ -98,7 +98,7 @@ Java_go_interfaces_Interfaces_Add3(JNIEnv* env, jclass clazz, jobject r) {
}
JNIEXPORT void JNICALL
Java_go_interfaces_Interfaces_CallErr(JNIEnv* env, jclass clazz, jobject e) {
Java_go_interfaces_Interfaces_callErr(JNIEnv* env, jclass clazz, jobject e) {
int32_t _e = go_seq_to_refnum(env, e);
int32_t r0 = proxyinterfaces__CallErr(_e);
jobject _r0 = go_seq_from_refnum(env, r0, proxy_class__error, proxy_class__error_cons);
@@ -106,14 +106,14 @@ Java_go_interfaces_Interfaces_CallErr(JNIEnv* env, jclass clazz, jobject e) {
}
JNIEXPORT jobject JNICALL
Java_go_interfaces_Interfaces_Seven(JNIEnv* env, jclass clazz) {
Java_go_interfaces_Interfaces_seven(JNIEnv* env, jclass clazz) {
int32_t r0 = proxyinterfaces__Seven();
jobject _r0 = go_seq_from_refnum(env, r0, proxy_class_interfaces_I, proxy_class_interfaces_I_cons);
return _r0;
}
JNIEXPORT void JNICALL
Java_go_interfaces_Interfaces_00024proxyError_Err(JNIEnv* env, jobject this) {
Java_go_interfaces_Interfaces_00024proxyError_err(JNIEnv* env, jobject this) {
int32_t o = go_seq_to_refnum(env, this);
int32_t r0 = proxyinterfaces_Error_Err(o);
jobject _r0 = go_seq_from_refnum(env, r0, proxy_class__error, proxy_class__error_cons);
@@ -131,7 +131,7 @@ int32_t cproxyinterfaces_Error_Err(int32_t refnum) {
}
JNIEXPORT jint JNICALL
Java_go_interfaces_Interfaces_00024proxyI_Rand(JNIEnv* env, jobject this) {
Java_go_interfaces_Interfaces_00024proxyI_rand(JNIEnv* env, jobject this) {
int32_t o = go_seq_to_refnum(env, this);
int32_t r0 = proxyinterfaces_I_Rand(o);
jint _r0 = (jint)r0;
@@ -148,7 +148,7 @@ int32_t cproxyinterfaces_I_Rand(int32_t refnum) {
}
JNIEXPORT void JNICALL
Java_go_interfaces_Interfaces_00024proxyI1_J(JNIEnv* env, jobject this) {
Java_go_interfaces_Interfaces_00024proxyI1_j(JNIEnv* env, jobject this) {
int32_t o = go_seq_to_refnum(env, this);
proxyinterfaces_I1_J(o);
}
@@ -161,7 +161,7 @@ void cproxyinterfaces_I1_J(int32_t refnum) {
}
JNIEXPORT void JNICALL
Java_go_interfaces_Interfaces_00024proxyI2_G(JNIEnv* env, jobject this) {
Java_go_interfaces_Interfaces_00024proxyI2_g(JNIEnv* env, jobject this) {
int32_t o = go_seq_to_refnum(env, this);
proxyinterfaces_I2_G(o);
}
@@ -174,7 +174,7 @@ void cproxyinterfaces_I2_G(int32_t refnum) {
}
JNIEXPORT jobject JNICALL
Java_go_interfaces_Interfaces_00024proxyI3_F(JNIEnv* env, jobject this) {
Java_go_interfaces_Interfaces_00024proxyI3_f(JNIEnv* env, jobject this) {
int32_t o = go_seq_to_refnum(env, this);
int32_t r0 = proxyinterfaces_I3_F(o);
jobject _r0 = go_seq_from_refnum(env, r0, proxy_class_interfaces_I1, proxy_class_interfaces_I1_cons);
@@ -191,7 +191,7 @@ int32_t cproxyinterfaces_I3_F(int32_t refnum) {
}
JNIEXPORT void JNICALL
Java_go_interfaces_Interfaces_00024proxyLargerI_AnotherFunc(JNIEnv* env, jobject this) {
Java_go_interfaces_Interfaces_00024proxyLargerI_anotherFunc(JNIEnv* env, jobject this) {
int32_t o = go_seq_to_refnum(env, this);
proxyinterfaces_LargerI_AnotherFunc(o);
}
@@ -204,7 +204,7 @@ void cproxyinterfaces_LargerI_AnotherFunc(int32_t refnum) {
}
JNIEXPORT jint JNICALL
Java_go_interfaces_Interfaces_00024proxyLargerI_Rand(JNIEnv* env, jobject this) {
Java_go_interfaces_Interfaces_00024proxyLargerI_rand(JNIEnv* env, jobject this) {
int32_t o = go_seq_to_refnum(env, this);
int32_t r0 = proxyinterfaces_LargerI_Rand(o);
jint _r0 = (jint)r0;
@@ -221,7 +221,7 @@ int32_t cproxyinterfaces_LargerI_Rand(int32_t refnum) {
}
JNIEXPORT jint JNICALL
Java_go_interfaces_Interfaces_00024proxySameI_Rand(JNIEnv* env, jobject this) {
Java_go_interfaces_Interfaces_00024proxySameI_rand(JNIEnv* env, jobject this) {
int32_t o = go_seq_to_refnum(env, this);
int32_t r0 = proxyinterfaces_SameI_Rand(o);
jint _r0 = (jint)r0;
@@ -238,7 +238,7 @@ int32_t cproxyinterfaces_SameI_Rand(int32_t refnum) {
}
JNIEXPORT void JNICALL
Java_go_interfaces_Interfaces_00024proxyWithParam_HasParam(JNIEnv* env, jobject this, jboolean p0) {
Java_go_interfaces_Interfaces_00024proxyWithParam_hasParam(JNIEnv* env, jobject this, jboolean p0) {
int32_t o = go_seq_to_refnum(env, this);
char _p0 = (char)p0;
proxyinterfaces_WithParam_HasParam(o, _p0);
+23 -23
View File
@@ -7,7 +7,7 @@ package go.interfaces;
import go.Seq;
public interface Error {
public void Err() throws Exception;
public void err() throws Exception;
}
@@ -20,7 +20,7 @@ package go.interfaces;
import go.Seq;
public interface I {
public int Rand();
public int rand();
}
@@ -33,7 +33,7 @@ package go.interfaces;
import go.Seq;
public interface I1 {
public void J();
public void j();
}
@@ -46,7 +46,7 @@ package go.interfaces;
import go.Seq;
public interface I2 {
public void G();
public void g();
}
@@ -59,7 +59,7 @@ package go.interfaces;
import go.Seq;
public interface I3 {
public I1 F();
public I1 f();
}
@@ -72,8 +72,8 @@ package go.interfaces;
import go.Seq;
public interface LargerI extends I, SameI {
public void AnotherFunc();
public int Rand();
public void anotherFunc();
public int rand();
}
@@ -86,7 +86,7 @@ package go.interfaces;
import go.Seq;
public interface SameI {
public int Rand();
public int rand();
}
@@ -99,7 +99,7 @@ package go.interfaces;
import go.Seq;
public interface WithParam {
public void HasParam(boolean p0);
public void hasParam(boolean p0);
}
@@ -114,7 +114,7 @@ import go.Seq;
public abstract class Interfaces {
static {
Seq.touch(); // for loading the native library
init();
_init();
}
private Interfaces() {} // uninstantiable
@@ -122,52 +122,52 @@ public abstract class Interfaces {
// touch is called from other bound packages to initialize this package
public static void touch() {}
private static native void init();
private static native void _init();
private static final class proxyError extends Seq.Proxy implements Error {
proxyError(Seq.Ref ref) { super(ref); }
public native void Err() throws Exception;
public native void err() throws Exception;
}
private static final class proxyI extends Seq.Proxy implements I {
proxyI(Seq.Ref ref) { super(ref); }
public native int Rand();
public native int rand();
}
private static final class proxyI1 extends Seq.Proxy implements I1 {
proxyI1(Seq.Ref ref) { super(ref); }
public native void J();
public native void j();
}
private static final class proxyI2 extends Seq.Proxy implements I2 {
proxyI2(Seq.Ref ref) { super(ref); }
public native void G();
public native void g();
}
private static final class proxyI3 extends Seq.Proxy implements I3 {
proxyI3(Seq.Ref ref) { super(ref); }
public native I1 F();
public native I1 f();
}
private static final class proxyLargerI extends Seq.Proxy implements LargerI {
proxyLargerI(Seq.Ref ref) { super(ref); }
public native void AnotherFunc();
public native int Rand();
public native void anotherFunc();
public native int rand();
}
private static final class proxySameI extends Seq.Proxy implements SameI {
proxySameI(Seq.Ref ref) { super(ref); }
public native int Rand();
public native int rand();
}
private static final class proxyWithParam extends Seq.Proxy implements WithParam {
proxyWithParam(Seq.Ref ref) { super(ref); }
public native void HasParam(boolean p0);
public native void hasParam(boolean p0);
}
public static native int Add3(I r);
public static native void CallErr(Error e) throws Exception;
public static native I Seven();
public static native int add3(I r);
public static native void callErr(Error e) throws Exception;
public static native I seven();
}
+5 -5
View File
@@ -17,7 +17,7 @@ jclass proxy_class_issue10788_TestStruct;
jmethodID proxy_class_issue10788_TestStruct_cons;
JNIEXPORT void JNICALL
Java_go_issue10788_Issue10788_init(JNIEnv *env, jclass _unused) {
Java_go_issue10788_Issue10788__1init(JNIEnv *env, jclass _unused) {
jclass clazz;
clazz = (*env)->FindClass(env, "go/issue10788/TestStruct");
proxy_class_issue10788_TestStruct = (*env)->NewGlobalRef(env, clazz);
@@ -26,8 +26,8 @@ Java_go_issue10788_Issue10788_init(JNIEnv *env, jclass _unused) {
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");
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");
}
@@ -47,7 +47,7 @@ Java_go_issue10788_TestStruct_getValue(JNIEnv *env, jobject this) {
}
JNIEXPORT void JNICALL
Java_go_issue10788_Issue10788_00024proxyTestInterface_DoSomeWork(JNIEnv* env, jobject this, jobject s) {
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);
@@ -62,7 +62,7 @@ void cproxyissue10788_TestInterface_DoSomeWork(int32_t refnum, int32_t s) {
}
JNIEXPORT void JNICALL
Java_go_issue10788_Issue10788_00024proxyTestInterface_MultipleUnnamedParams(JNIEnv* env, jobject this, jlong p0, jstring p1, jlong p2) {
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);
+6 -6
View File
@@ -50,8 +50,8 @@ package go.issue10788;
import go.Seq;
public interface TestInterface {
public void DoSomeWork(TestStruct s);
public void MultipleUnnamedParams(long p0, String p1, long p2);
public void doSomeWork(TestStruct s);
public void multipleUnnamedParams(long p0, String p1, long p2);
}
@@ -66,7 +66,7 @@ import go.Seq;
public abstract class Issue10788 {
static {
Seq.touch(); // for loading the native library
init();
_init();
}
private Issue10788() {} // uninstantiable
@@ -74,13 +74,13 @@ public abstract class Issue10788 {
// touch is called from other bound packages to initialize this package
public static void touch() {}
private static native void init();
private static native void _init();
private static final class proxyTestInterface extends Seq.Proxy implements TestInterface {
proxyTestInterface(Seq.Ref ref) { super(ref); }
public native void DoSomeWork(TestStruct s);
public native void MultipleUnnamedParams(long p0, String p1, long p2);
public native void doSomeWork(TestStruct s);
public native void multipleUnnamedParams(long p0, String p1, long p2);
}
+1 -1
View File
@@ -13,7 +13,7 @@ jclass proxy_class_issue12328_T;
jmethodID proxy_class_issue12328_T_cons;
JNIEXPORT void JNICALL
Java_go_issue12328_Issue12328_init(JNIEnv *env, jclass _unused) {
Java_go_issue12328_Issue12328__1init(JNIEnv *env, jclass _unused) {
jclass clazz;
clazz = (*env)->FindClass(env, "go/issue12328/T");
proxy_class_issue12328_T = (*env)->NewGlobalRef(env, clazz);
+2 -2
View File
@@ -52,7 +52,7 @@ import go.Seq;
public abstract class Issue12328 {
static {
Seq.touch(); // for loading the native library
init();
_init();
}
private Issue12328() {} // uninstantiable
@@ -60,7 +60,7 @@ public abstract class Issue12328 {
// touch is called from other bound packages to initialize this package
public static void touch() {}
private static native void init();
private static native void _init();
+5 -5
View File
@@ -15,19 +15,19 @@ static jmethodID mid_Parsable_FromJSON;
static jmethodID mid_Parsable_ToJSON;
JNIEXPORT void JNICALL
Java_go_issue12403_Issue12403_init(JNIEnv *env, jclass _unused) {
Java_go_issue12403_Issue12403__1init(JNIEnv *env, jclass _unused) {
jclass clazz;
clazz = (*env)->FindClass(env, "go/issue12403/Issue12403$proxyParsable");
proxy_class_issue12403_Parsable = (*env)->NewGlobalRef(env, clazz);
proxy_class_issue12403_Parsable_cons = (*env)->GetMethodID(env, clazz, "<init>", "(Lgo/Seq$Ref;)V");
clazz = (*env)->FindClass(env, "go/issue12403/Parsable");
mid_Parsable_FromJSON = (*env)->GetMethodID(env, clazz, "FromJSON", "(Ljava/lang/String;)Ljava/lang/String;");
mid_Parsable_ToJSON = (*env)->GetMethodID(env, clazz, "ToJSON", "()Ljava/lang/String;");
mid_Parsable_FromJSON = (*env)->GetMethodID(env, clazz, "fromJSON", "(Ljava/lang/String;)Ljava/lang/String;");
mid_Parsable_ToJSON = (*env)->GetMethodID(env, clazz, "toJSON", "()Ljava/lang/String;");
}
JNIEXPORT jstring JNICALL
Java_go_issue12403_Issue12403_00024proxyParsable_FromJSON(JNIEnv* env, jobject this, jstring jstr) {
Java_go_issue12403_Issue12403_00024proxyParsable_fromJSON(JNIEnv* env, jobject this, jstring jstr) {
int32_t o = go_seq_to_refnum(env, this);
nstring _jstr = go_seq_from_java_string(env, jstr);
nstring r0 = proxyissue12403_Parsable_FromJSON(o, _jstr);
@@ -46,7 +46,7 @@ nstring cproxyissue12403_Parsable_FromJSON(int32_t refnum, nstring jstr) {
}
JNIEXPORT jstring JNICALL
Java_go_issue12403_Issue12403_00024proxyParsable_ToJSON(JNIEnv* env, jobject this) {
Java_go_issue12403_Issue12403_00024proxyParsable_toJSON(JNIEnv* env, jobject this) {
int32_t o = go_seq_to_refnum(env, this);
struct proxyissue12403_Parsable_ToJSON_return res = proxyissue12403_Parsable_ToJSON(o);
jstring _r0 = go_seq_to_java_string(env, res.r0);
+6 -6
View File
@@ -7,8 +7,8 @@ package go.issue12403;
import go.Seq;
public interface Parsable {
public String FromJSON(String jstr);
public String ToJSON() throws Exception;
public String fromJSON(String jstr);
public String toJSON() throws Exception;
}
@@ -23,7 +23,7 @@ import go.Seq;
public abstract class Issue12403 {
static {
Seq.touch(); // for loading the native library
init();
_init();
}
private Issue12403() {} // uninstantiable
@@ -31,13 +31,13 @@ public abstract class Issue12403 {
// touch is called from other bound packages to initialize this package
public static void touch() {}
private static native void init();
private static native void _init();
private static final class proxyParsable extends Seq.Proxy implements Parsable {
proxyParsable(Seq.Ref ref) { super(ref); }
public native String FromJSON(String jstr);
public native String ToJSON() throws Exception;
public native String fromJSON(String jstr);
public native String toJSON() throws Exception;
}

Some files were not shown because too many files have changed in this diff Show More