You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@avro.apache.org by Jeff Hammerbacher <ha...@cloudera.com> on 2010/05/18 09:20:58 UTC

Protocol messages for which the response is null

Hey,

I've got a protocol where many of the methods which do not return a
response; that is, they have "response": "null" in the protocol definition.
When I use the Java Specific compiler, I end up with a method whose return
type is java.lang.Void, rather than void. If, in the server implementation,
I use "void" rather than "Void" as the return type of the method, javac
complains that I have not implemented the interface correctly. Yet if I make
Void the return type of the implementing method, I can't figure out what to
return! new Void() doesn't work, and return; doesn't work either.

My knowledge of Java is quite limited, so any guidance on what to do here
would be helpful.

Thanks,
Jeff

Re: Protocol messages for which the response is null

Posted by Ryan Rawson <ry...@gmail.com>.
For the mysterious Void object type use 'null'.

Pretty non obvious.. dog!

On May 18, 2010 12:21 AM, "Jeff Hammerbacher" <ha...@cloudera.com> wrote:

Hey,

I've got a protocol where many of the methods which do not return a
response; that is, they have "response": "null" in the protocol definition.
When I use the Java Specific compiler, I end up with a method whose return
type is java.lang.Void, rather than void. If, in the server implementation,
I use "void" rather than "Void" as the return type of the method, javac
complains that I have not implemented the interface correctly. Yet if I make
Void the return type of the implementing method, I can't figure out what to
return! new Void() doesn't work, and return; doesn't work either.

My knowledge of Java is quite limited, so any guidance on what to do here
would be helpful.

Thanks,
Jeff