bind: generate reverse bindings for implicit Java types

Before this CL, Java types that were only implicitly referenced
were represented as interface{}. However, if a value of such an
implicit type were passed to Java, a runtime crash would occur
because there would be no wrapper class to unwrap.

Fix this by generating implicit types, fixing the crashes,
gaining type safety, and removing the interface{} special case in
the generator.

While we're here, remove a redundant insert to the clsMap map in
java.go.

Change-Id: Ic50125da3d7cd6075899bf628d419b084c630490
Reviewed-on: https://go-review.googlesource.com/34777
Reviewed-by: David Crawshaw <crawshaw@golang.org>
This commit is contained in:
Elias Naur
2017-01-11 19:09:27 +00:00
parent ff6f6e8d8e
commit fe0977739a
8 changed files with 280 additions and 36 deletions
-6
View File
@@ -114,12 +114,6 @@ public class ClassesTest extends InstrumentationTestCase {
assertEquals("IOException message", Javapkg.IOExceptionMessage, exc.getMessage());
}
public void testUnknownType() {
GoObject o = new GoObject();
o.toString(); // Set this
assertTrue("GoObject.getClass not null", o.checkClass());
}
public void testInnerClass() {
Character.Subset s = new Character.Subset(""){};
Character.Subset s2 = new GoSubset("");