Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/mobile/cmd/gobind: support null Java interface implementations #14228

Closed
eliasnaur opened this issue Feb 4, 2016 · 1 comment
Closed

x/mobile/cmd/gobind: support null Java interface implementations #14228

eliasnaur opened this issue Feb 4, 2016 · 1 comment

Comments

@eliasnaur
Copy link
Contributor

gobind should support java null pointers and consider them to nil interfaces instead of crashing. I've attached a simple change to the bind example to demonstrate this issue. Compiling and running it results in the following exception:

02-04 16:15:11.008 11339 11339 E AndroidRuntime: Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'go.Seq$Ref go.hello.Hello$Interface.ref()' on a null object reference
02-04 16:15:11.008 11339 11339 E AndroidRuntime: at go.hello.Hello.InterfaceTest(Hello.java:85)
02-04 16:15:11.008 11339 11339 E AndroidRuntime: at org.golang.example.bind.MainActivity.onCreate(MainActivity.java:27)
02-04 16:15:11.008 11339 11339 E AndroidRuntime: at android.app.Activity.performCreate(Activity.java:6251)
02-04 16:15:11.008 11339 11339 E AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
02-04 16:15:11.008 11339 11339 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
02-04 16:15:11.008 11339 11339 E AndroidRuntime: ... 9 more

niltest.txt

@gopherbot
Copy link

CL https://golang.org/cl/19460 mentions this issue.

@golang golang locked and limited conversation to collaborators Feb 28, 2017
imWildCat pushed a commit to imWildCat/go-mobile that referenced this issue Apr 10, 2021
The Seq Java class has a special case for null references. Expand
the special case to Go so that null references from Java are properly
translated to nil.

Fixes golang/go#14228

Change-Id: I915d1f843c9db299d6910480f6d10dae0121a3b4
Reviewed-on: https://go-review.googlesource.com/19460
Reviewed-by: David Crawshaw <crawshaw@golang.org>
imWildCat pushed a commit to imWildCat/go-mobile that referenced this issue Apr 11, 2021
The Seq Java class has a special case for null references. Expand
the special case to Go so that null references from Java are properly
translated to nil.

Fixes golang/go#14228

Change-Id: I915d1f843c9db299d6910480f6d10dae0121a3b4
Reviewed-on: https://go-review.googlesource.com/19460
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants