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/bind/java: mapping 'int' type for java #11421

Closed
hyangah opened this issue Jun 26, 2015 · 4 comments
Closed

x/mobile/bind/java: mapping 'int' type for java #11421

hyangah opened this issue Jun 26, 2015 · 4 comments
Labels
FrozenDueToAge mobile Android, iOS, and x/mobile
Milestone

Comments

@hyangah
Copy link
Contributor

hyangah commented Jun 26, 2015

Go's int type size is platform dependent.
Java's int type is always 32bit.
Gobind currently maps 'int' to 'long' type to have a consistent api while dealing with 64bit values that may return from Go.

On 32bit platform this can be problematic if the Java API passes larger than the 32bit int max. Generating a different API depending on the platform is not an option, but we need a way to limit the value that can be passed into Go depending on the platform.

@hyangah hyangah added this to the Go1.6 milestone Jun 26, 2015
@dr2chase
Copy link
Contributor

Can we simply use int32 and int64? Those will never be wrong, and we really ought not be encouraging use of "int" where the size matters.

@eliasnaur
Copy link
Contributor

@dr2chase, gomobile binds an existing Go API, so unless we ban the use of ints in bound packages, we can't avoid them.

@hyangah, I'm not sure what needs to be done for this issue to be fixed. Calling Go from Java on 32 bit platforms truncates ints larger than the 32 bit maximum. That is unfortunate but what would you prefer instead? A runtime error, or something else?

@hyangah
Copy link
Contributor Author

hyangah commented Jul 7, 2016

@eliasnaur I think the best option for this bug is to mark it as unfixable. When a user decides to use int in the API, the user did so because on 32bit platform, 32bit integer is sufficient for their API.

@gopherbot gopherbot added the mobile Android, iOS, and x/mobile label Jul 20, 2017
@eliasnaur
Copy link
Contributor

Closing this as wont fix.

@golang golang locked and limited conversation to collaborators Mar 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge mobile Android, iOS, and x/mobile
Projects
None yet
Development

No branches or pull requests

4 participants