Navigation Menu

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: interface with exported method that takes a pointer to struct generates incorrect java binding #10788

Closed
hyangah opened this issue May 12, 2015 · 1 comment
Milestone

Comments

@hyangah
Copy link
Contributor

hyangah commented May 12, 2015

From https://groups.google.com/d/msg/golang-nuts/LzYlrZHkGQU/Xa8-QERRyDMJ

type TestStruct struct {
 Value string
}

type TestInterface interface {
 DoSomeWork(s *TestStruct)
}

generates

   public static abstract class Stub implements TestInterface {
            static final String DESCRIPTOR = "go.demo.TestInterface";
            
            private final go.Seq.Ref ref;
            public Stub() {
                ref = go.Seq.createRef(this);
            }
            
            public go.Seq.Ref ref() { return ref; }
            
            public void call(int code, go.Seq in, go.Seq out) {
                switch (code) {
                case Proxy.CALL_DoSomeWork: {
                    TestStruct param_s = in.readRef();  /* BUG: this should be TestStruct param_s = new TestStruct(in.readRef()) */
                    this.DoSomeWork(param_s);
                    return;
                }
                default:
                    throw new RuntimeException("unknown code: "+ code);
                }
            }
        }
@hyangah hyangah self-assigned this May 12, 2015
@hyangah hyangah added this to the Go1.5 milestone May 12, 2015
@gopherbot
Copy link

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

@golang golang locked and limited conversation to collaborators Jun 25, 2016
imWildCat pushed a commit to imWildCat/go-mobile that referenced this issue Apr 10, 2021
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>
imWildCat pushed a commit to imWildCat/go-mobile that referenced this issue Apr 11, 2021
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>
@rsc rsc unassigned hyangah Jun 23, 2022
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