2
0
mirror of synced 2025-02-23 23:08:14 +00:00
mobile/bind/testdata/issue10788.java.golden
Elias Naur 5e11c20fc0 mobile/bind: don't force Java classes to extend stub classes
Requiring user code to extend Go interface Stubs to be able to pass
Java objects to Go is clumsy and use up the single extend slot.
Instead, support (and enforce) java classes to implement translated
Go interface directly. This is similar to how ObjC works.

The stub classes are now gone, and users of gobind Java APIs need
to update their code to implement interfaces directly.

Change-Id: I880bb7c8e89d3c21210b2ab2c85ced8d7859ff48
Reviewed-on: https://go-review.googlesource.com/21313
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-03-31 07:59:45 +00:00

71 lines
2.2 KiB
Plaintext

// Java class go.issue10788.Issue10788 is a proxy for talking to a Go program.
// gobind -lang=java issue10788
//
// File is generated by gobind. Do not edit.
package go.issue10788;
import go.Seq;
public abstract class Issue10788 {
static {
Seq.touch(); // for loading the native library
init();
}
private Issue10788() {} // uninstantiable
// touch is called from other bound packages to initialize this package
public static void touch() {}
private static native void init();
public static final class TestStruct extends Seq.Proxy {
private TestStruct(go.Seq.Ref ref) { super(ref); }
public final native String getValue();
public final native void setValue(String v);
@Override public boolean equals(Object o) {
if (o == null || !(o instanceof TestStruct)) {
return false;
}
TestStruct that = (TestStruct)o;
String thisValue = getValue();
String thatValue = that.getValue();
if (thisValue == null) {
if (thatValue != null) {
return false;
}
} else if (!thisValue.equals(thatValue)) {
return false;
}
return true;
}
@Override public int hashCode() {
return java.util.Arrays.hashCode(new Object[] {getValue()});
}
@Override public String toString() {
StringBuilder b = new StringBuilder();
b.append("TestStruct").append("{");
b.append("Value:").append(getValue()).append(",");
return b.append("}").toString();
}
}
public interface TestInterface {
public void DoSomeWork(TestStruct s);
public void MultipleUnnamedParams(long p0, String p1, long p2);
static final class Proxy extends Seq.Proxy implements TestInterface {
Proxy(Seq.Ref ref) { super(ref); }
public native void DoSomeWork(TestStruct s);
public native void MultipleUnnamedParams(long p0, String p1, long p2);
}
}
}