gobind: Interface with exported method that has a pointer to struct doesn't seem to generate correct java binding

60 views
Skip to first unread message

kunal...@gmail.com

unread,
May 11, 2015, 9:38:23 PM5/11/15
to golan...@googlegroups.com
Consider the following example:

type TestStruct struct {
 
Value string
}


type
TestInterface interface {
 
DoSomeWork(s *TestStruct)
}



The stub code generated for this interface is:

    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();
                   
this.DoSomeWork(param_s);
                   
return;
               
}
               
default:
                   
throw new RuntimeException("unknown code: "+ code);
               
}
           
}
       
}


Specifically, 



case Proxy.CALL_DoSomeWork: {
                   TestStruct param_s = in.readRef();
                   this.DoSomeWork(param_s);
                   return;
               }

is problematic because its trying to assign a ref object to the underlying java object which is of type TestStruct.

Could be that I'm doing something wrong here - would love any input!



Hyang-Ah Hana Kim

unread,
May 12, 2015, 12:39:23 AM5/12/15
to kunal...@gmail.com, golan...@googlegroups.com
Thanks for the report. That's a bug.
I will send a fix tomorrow. 

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
__
Reply all
Reply to author
Forward
0 new messages