Status: New
Owner: liuj...@google.com
Labels: Type-Defect Priority-Medium

New issue 609 by jhaf...@gmail.com: protoc produces java code with compiler errors when terminating message field names with "field"
http://code.google.com/p/protobuf/issues/detail?id=609

1. Use protoc (1.5.0) to generate java code for the following .proto file:
==========================================================================
package example;

message WhateverMessage {
   required string whatever = 110;
}

message ProblemMessage {
   optional WhateverMessage foobar = 120;
   optional WhateverMessage foobar_field = 130;
}
==========================================================================

2. Compile the resulting java code including jars for protobuf-java 1.5.0


I am expecting to get code that compiles, instead I get a compilter error, "Duplicate method getFoobarFieldBuilde() in type Example.ProblemMessage.Builder".

This is being built with protoc 1.5.0 and corresponding protobuf-java 1.5.0 on Red Hat Enterprise Linux 6

The problem appears to be related to having one field ("foobar_field") being having another field's name followed by "_field". If I change the name of foobar_field to something else, all works fine. The code generation uses a scheme that does not guarantee unique method names in this case.

The problem also requires that both fields be a a defined message type. If we change one or the other to being a string, the problem will not occur.


--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups "Protocol 
Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to