Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JProtoc does not account for name collisions between #66

Closed
rmichela opened this issue Dec 3, 2017 · 1 comment
Closed

JProtoc does not account for name collisions between #66

rmichela opened this issue Dec 3, 2017 · 1 comment
Labels
Milestone

Comments

@rmichela
Copy link
Collaborator

rmichela commented Dec 3, 2017

  • Absent option java_outer_classname, protoc generates an outer java class for each .proto file with a name derived from the .proto file name.
  • If no explicit java_outer_classname is specified in the .proto file, the class name will be constructed by converting the .proto file name to camel-case (so foo_bar.proto becomes FooBar.java)
  • Protoc generates an inner class for each message type in the proto with a name that matches the message type name.
  • In the event of a name conflict between the outer and inner type names, protoc adds an OuterClass suffix to the outer type's name.

JProtoc is not correctly accounting for the name collision between the outer and inner class name.

// If the outer class name is not explicitly defined, then we take the proto filename, strip its extension,
// and convert it from snake case to camel case.
String filename = fileDescriptor.getName().substring(0, fileDescriptor.getName().length() - ".proto".length());
return CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, filename);

@rmichela
Copy link
Collaborator Author

Released

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant