You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Steve Yegge (JIRA)" <ji...@apache.org> on 2015/10/28 20:51:27 UTC

[jira] [Created] (THRIFT-3401) Nested collections emit Objective-C code that cannot compile

Steve Yegge created THRIFT-3401:
-----------------------------------

             Summary: Nested collections emit Objective-C code that cannot compile
                 Key: THRIFT-3401
                 URL: https://issues.apache.org/jira/browse/THRIFT-3401
             Project: Thrift
          Issue Type: Bug
          Components: Cocoa - Compiler
    Affects Versions: 1.0
         Environment: OS X 10.9 and 10.10
            Reporter: Steve Yegge
            Priority: Critical


Nested Thrift collections produce nested generics in Objective-C.  Unfortunately, Objective-C generics do not appear to support type nesting.

For instance,

  1: list<list<string>> foo

generates an Objective-C declaration like this

  @property (strong, nonatomic) NSMutableArray<NSArray<NSString *>> * foo;

which results in an XCode compile error:  Type argument 'NSArray<NSString *>' is neither an Objective-C object nor a block type

The only workaround is to edit the generated code to remove the nested type specifiers.

Until Objective-C supports nesting generic types, the Thrift cocoa compiler should limit the type nesting to at most one level -- NSMutableArray<NSArray> is legal, for instance.  Alternately, an easier solution might be to add a flag that disables the generation of generic types for cocoa.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)