bind: fix Java code generation that takes reference type params.

Also fixes a parameter name handling problem when processing a
function signature that omits parameter names.

Fixes golang/go#10788.

Change-Id: I65273d330bbf3a836ec9e4ffb691927970d795d8
Reviewed-on: https://go-review.googlesource.com/9926
Reviewed-by: Alan Donovan <adonovan@google.com>
This commit is contained in:
Hyang-Ah (Hana) Kim
2015-05-12 22:05:40 +00:00
committed by Hyang-Ah Hana Kim
parent 910c3fc64e
commit 4f4272d70b
8 changed files with 281 additions and 8 deletions
+19
View File
@@ -137,6 +137,10 @@ public class SeqTest extends AndroidTestCase {
return Testpkg.New();
}
public String StoString(Testpkg.S s) {
return s.String();
}
public long V() {
return 1234;
}
@@ -187,6 +191,14 @@ public class SeqTest extends AndroidTestCase {
Testpkg.S s = Testpkg.CallS(obj);
}
public void testInterfaceMethodTakesStructPointer() {
final AnI obj = new AnI();
Testpkg.S s = Testpkg.CallS(obj);
String got = obj.StoString(s);
String want = s.String();
assertEquals("Want AnI.StoString(s) to call s's String", want, got);
}
public void testInterfaceMethodReturnsInt() {
final AnI obj = new AnI();
assertEquals("Values must match", 1234, Testpkg.CallV(obj));
@@ -231,4 +243,11 @@ public class SeqTest extends AndroidTestCase {
System.gc();
System.runFinalization();
}
public void testUnnamedParams() {
final String msg = "1234567";
assertEquals("Want the length of \"1234567\" passed after unnamed params",
7, Testpkg.UnnamedParams(10, 20, msg));
}
}