You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Jano Svitok (Jira)" <ji...@apache.org> on 2020/04/01 13:59:00 UTC

[jira] [Created] (THRIFT-5160) Swift: generated processor does work for extended classes

Jano Svitok created THRIFT-5160:
-----------------------------------

             Summary: Swift: generated processor does work for extended classes
                 Key: THRIFT-5160
                 URL: https://issues.apache.org/jira/browse/THRIFT-5160
             Project: Thrift
          Issue Type: Bug
          Components: Swift - Compiler
    Affects Versions: 0.14.0
            Reporter: Jano Svitok


Let's say we have following IDL:

{code}
service service1 {
 void func1()
}

service service2 extends service1 {
 void func2()
}
{code}

compiler generates processor for service2:
{code:swift}
extension service2Processor : TProcessor {
  static let processorHandlers: ProcessorHandlerDictionary = {
    var processorHandlers = ProcessorHandlerDictionary()
    processorHandlers["func2"] = { sequenceID, inProtocol, outProtocol, handler in
       // ...processor for func2
    }
    return processorHandlers
  }()

  public func process(on inProtocol: TProtocol, outProtocol: TProtocol) throws {
    let (messageName, _, sequenceID) = try inProtocol.readMessageBegin()
    if let processorHandler = service2Processor.processorHandlers[messageName] {
       // ...process the message
    }
    else {
       // ...unknown message
    }
  }
}
{code}

This processor will not process {{func1}} since it's not in {{processorHandlers[]}}.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)