Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-3325

Extended services aren't subclasses in generated Cocoa

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Won't Fix
    • None
    • None
    • Cocoa - Library
    • None

    Description

      The following interface definition:

      service Parent {
           string name();
      }
      
      service Child extends Parent {
          i32 age();
      }
      

      Produces the following generated Cocoa (truncated for readability):

      @protocol Parent <NSObject>
      - (NSString *) name;  // throws TException
      @end
      
      // ...
      
      @protocol Child <NSObject>
      - (int32_t) age;  // throws TException
      @end
      
      @interface ChildClient : NSObject <Child> {
      id <TProtocol> inProtocol;
      id <TProtocol> outProtocol;
      }
      - (id) initWithProtocol: (id <TProtocol>) protocol;
      - (id) initWithInProtocol: (id <TProtocol>) inProtocol outProtocol: (id <TProtocol>) outProtocol;
      @end
      

      With these definitions, an instance of "Child" knows nothing of nor can ever have superclass method name() called on it. This completely breaks not only polymorphism, but the use of the "extends" keyword when generating Cocoa.

      This could be easily resolved by simply having the "Child" class also conform to the "Parent" protocol, or more-correctly resolved by making "Child" an actual subclass of "Parent".

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              rpj Ryan Joseph
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: