Avro
  1. Avro
  2. AVRO-1214

Generated protocol's method should return void instead of Void like one-way message

    Details

    • Type: Improvement Improvement
    • Status: Patch Available
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.7.2
    • Fix Version/s: 1.8.0
    • Component/s: java
    • Labels:
      None
    • Hadoop Flags:
      Incompatible change

      Description

      Using the following IDL:

      @namespace("org.apache.avro.test")
      protocol Simple {
        error TestError {
          string message;
        }
      
        string hello(string greeting);
        void `error`() throws TestError;
        void ping() oneway;
      }
      

      Will produce the interface:

      
      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;
        }
      }
      

      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.

        Activity

        Sébastien Launay created issue -
        Sébastien Launay made changes -
        Field Original Value New Value
        Status Open [ 1 ] Patch Available [ 10002 ]
        Sébastien Launay made changes -
        Attachment AVRO-1214-unbox-void-2012-12-05.patch [ 12556139 ]
        Doug Cutting made changes -
        Hadoop Flags Incompatible change [ 10342 ]
        Fix Version/s 1.8.0 [ 12323299 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Sébastien Launay
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:

              Development