Should reserved words be flagged, i.e. "descriptor" ?
kosty opened this issue · 3 comments
Problem
protoc
auto-generates several methods using get*
naming convention, which collides with attribute getter methods, i.e.
message Model {
int64 descriptor = 1;
}
is a valid proto3
construct. Yet java code generated from it by protoc
is un-compilable, as field's getter method collides with auto-generated getDescriptor
method. This issue was discussed previously at protobuf forums. It would be convenient to learn of this limitation early on, as opposed to late compile stage.
Desired solution
Fields with names that collide with auto-generated code should be flagged as warnings. Potentially there are multiple languages and proto follows idiomatic approach in every language, thus a reserved word in one language might not transfer to others. So warning should alert a developer, not preclude them from generating their code.
I second the suggestion. It is a "well known issue" however I wasn't able to find any references to the problem in the documentation. Please, state it clear somewhere so people can know beforehand.
This issue is closed as plugin is not supported anymore.
Please switch to https://github.com/jvolkman/intellij-protobuf-editor.
FYI, the suggested plugin has exactly the same problem, you can define a descriptor
field that clashes with the generated java code