I guess it's a good idea to treat the .proto file as a package in java

On Nov 13, 12:04 pm, bmadigan <[EMAIL PROTECTED]> wrote:
> I think I'm missing somthing in the style guidelines. If I have a
> proto file called "trip_summary.proto", which contains a message
> "TripSummary", protoc throws the following error:
> -protoc-single:
>      [exec] --java_out: trip_summary.proto: Cannot generate Java
> output because the file's outer class name, "TripSummary", matches the
> name of one of the types declared inside it.  Please either rename the
> type or use the java_outer_classname option to specify a different
> outer class name for the .proto file
> So, renaming the file to 'trip_summary_protos.proto', protoc generates
> 2 Java files, one called TripSummaryProtos.java, containing a static
> TripSummaryProtos, which contains an inner TripSummary class.
> Setting the option 'java_multiple_files=true', I get 2 java files,
> with the TripSummary class referencing all of the static members of
> TripSummaryProtos. This doesn't cause any problems with using
> TripSummary class (that I know of), but why is the container class
> necessary?
> Should I just define all of my messages in one file and ignore the
> outer class in my code?
> -bmadigan
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 

Reply via email to