My favorites | Sign in
Project Home Downloads Wiki Issues Source
New issue   Search
  Advanced search   Search tips   Subscriptions
Issue 137: [ProtocolBuffers] Obj-C classes produced from proto definitions that have a field named "result" fail to compile
2 people starred this issue and may be notified of changes. Back to list
Status:  New
Owner:  ----

Sign in to add a comment
Reported by, Jun 20, 2011
As the title says, proto messages that have a field named "result" produce Obj-C classes that fail to compile. For example, this .proto definition:

message Game {
	optional GameResult result = 1;

... gives in an Obj-C file that has a Game_Builder class which has a setResult: method for the Game's result variable. However, the Game_Builder class also has a @property defined for its internal result value (of type Game). Once it's synthesized, it yields another setResult: method, which conflicts with the setResult: method for Game_Builder's result field ("duplicate method definition" error).

I went through your compiler code and refactored the "result" variable to become "protobufBuilderResult". I used a name that is highly unlikely to be used as a field name inside a .proto file, but you can of course rename it to something else.

I attached the modified files, they're all from the src/google/protobuf/compiler/objectivec/ folder. Can you please integrate the changes?

Vladimir Mitrovic (
Lead iOS Dev at Nordeus (
14.7 KB   View   Download
21.5 KB   View   Download
31.2 KB   View   Download
15.5 KB   View   Download
Sign in to add a comment

Powered by Google Project Hosting