You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Sébastien Launay (JIRA)" <ji...@apache.org> on 2012/12/07 20:51:21 UTC

[jira] [Commented] (AVRO-1214) Generated protocol's method should return void instead of Void like one-way message

    [ https://issues.apache.org/jira/browse/AVRO-1214?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13526718#comment-13526718 ] 

Sébastien Launay commented on AVRO-1214:
----------------------------------------

You are right Apache versioning would require a 2.x major version for that, I can update the patch to add an option to the compiler/maven-plugin like the one for generating String instead of CharSequence.
Were you thinking of an option to keep Void turned off by default or an option to generate void turned off by default for 1.8.x?
                
> Generated protocol's method should return void instead of Void like one-way message
> -----------------------------------------------------------------------------------
>
>                 Key: AVRO-1214
>                 URL: https://issues.apache.org/jira/browse/AVRO-1214
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>    Affects Versions: 1.7.2
>            Reporter: Sébastien Launay
>            Priority: Minor
>             Fix For: 1.8.0
>
>         Attachments: AVRO-1214-unbox-void-2012-12-05.patch
>
>
> Using the following IDL:
> {noformat}
> @namespace("org.apache.avro.test")
> protocol Simple {
>   error TestError {
>     string message;
>   }
>   string hello(string greeting);
>   void `error`() throws TestError;
>   void ping() oneway;
> }
> {noformat}
> Will produce the interface:
> {code:java}
> package org.apache.avro.test;
> public interface Simple {
>   public static final org.apache.avro.Protocol PROTOCOL = org.apache.avro.Protocol.parse("...");
>   java.lang.CharSequence hello(java.lang.CharSequence greeting) throws org.apache.avro.AvroRemoteException;
>   java.lang.Void error() throws org.apache.avro.AvroRemoteException, org.apache.avro.test.TestError;
>   void ping();
>   public interface Callback extends Simple {
>     public static final org.apache.avro.Protocol PROTOCOL = org.apache.avro.test.Simple.PROTOCOL;
>     void hello(java.lang.CharSequence greeting, org.apache.avro.ipc.Callback<java.lang.CharSequence> callback) throws java.io.IOException;
>     void error(org.apache.avro.ipc.Callback<java.lang.Void> callback) throws java.io.IOException;
>   }
> }
> {code}
> Then one is forced to add {{return null;}} statement(s) in the interface implementation for the {{error()}} method which can be a bit cumbersome and that's not the case for the oneway {{ping()}} method.
> This is fine on the Callback though because the developer can just ignore the callback argument.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Re: [jira] [Commented] (AVRO-1214) Generated protocol's method should return void instead of Void like one-way message

Posted by Doug Cutting <cu...@apache.org>.
If we kept it Void by default then we could even include it in a 1.7.4
bugfix release.

Avro's release rules permit incompatible API changes in point releases
(e.g., 1.8).  Only incompatible data formats would force a 2.0
release.  Still, if we can reduce incompatible API changes in point
releases we can save a lot of pain.

On Fri, Dec 7, 2012 at 11:51 AM, Sébastien Launay (JIRA)
<ji...@apache.org> wrote:
>
>     [ https://issues.apache.org/jira/browse/AVRO-1214?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13526718#comment-13526718 ]
>
> Sébastien Launay commented on AVRO-1214:
> ----------------------------------------
>
> You are right Apache versioning would require a 2.x major version for that, I can update the patch to add an option to the compiler/maven-plugin like the one for generating String instead of CharSequence.
> Were you thinking of an option to keep Void turned off by default or an option to generate void turned off by default for 1.8.x?
>
>> Generated protocol's method should return void instead of Void like one-way message
>> -----------------------------------------------------------------------------------
>>
>>                 Key: AVRO-1214
>>                 URL: https://issues.apache.org/jira/browse/AVRO-1214
>>             Project: Avro
>>          Issue Type: Improvement
>>          Components: java
>>    Affects Versions: 1.7.2
>>            Reporter: Sébastien Launay
>>            Priority: Minor
>>             Fix For: 1.8.0
>>
>>         Attachments: AVRO-1214-unbox-void-2012-12-05.patch
>>
>>
>> Using the following IDL:
>> {noformat}
>> @namespace("org.apache.avro.test")
>> protocol Simple {
>>   error TestError {
>>     string message;
>>   }
>>   string hello(string greeting);
>>   void `error`() throws TestError;
>>   void ping() oneway;
>> }
>> {noformat}
>> Will produce the interface:
>> {code:java}
>> package org.apache.avro.test;
>> public interface Simple {
>>   public static final org.apache.avro.Protocol PROTOCOL = org.apache.avro.Protocol.parse("...");
>>   java.lang.CharSequence hello(java.lang.CharSequence greeting) throws org.apache.avro.AvroRemoteException;
>>   java.lang.Void error() throws org.apache.avro.AvroRemoteException, org.apache.avro.test.TestError;
>>   void ping();
>>   public interface Callback extends Simple {
>>     public static final org.apache.avro.Protocol PROTOCOL = org.apache.avro.test.Simple.PROTOCOL;
>>     void hello(java.lang.CharSequence greeting, org.apache.avro.ipc.Callback<java.lang.CharSequence> callback) throws java.io.IOException;
>>     void error(org.apache.avro.ipc.Callback<java.lang.Void> callback) throws java.io.IOException;
>>   }
>> }
>> {code}
>> Then one is forced to add {{return null;}} statement(s) in the interface implementation for the {{error()}} method which can be a bit cumbersome and that's not the case for the oneway {{ping()}} method.
>> This is fine on the Callback though because the developer can just ignore the callback argument.
>
> --
> This message is automatically generated by JIRA.
> If you think it was sent incorrectly, please contact your JIRA administrators
> For more information on JIRA, see: http://www.atlassian.com/software/jira