From 9804b67f1aeb340f452b64c71ce49e489f190d64 Mon Sep 17 00:00:00 2001 From: Eric Anderson Date: Wed, 3 Feb 2016 09:50:41 -0800 Subject: [PATCH] Include Proto in the java_outer_classname for helloworld.proto Specifying the outer class is a pretty common convention and avoids the outer classname changing depending on the contents of the proto file (as can be seen if outer_classname isn't specified in the route guide example). To avoid colliding, convention has it end in "Proto". --- .../java/io/grpc/examples/helloworld/HelloReply.java | 10 +++++----- .../java/io/grpc/examples/helloworld/HelloRequest.java | 10 +++++----- .../{HelloWorld.java => HelloWorldProto.java} | 8 ++++---- examples/src/main/proto/helloworld.proto | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) rename examples/src/generated/main/java/io/grpc/examples/helloworld/{HelloWorld.java => HelloWorldProto.java} (93%) diff --git a/examples/src/generated/main/java/io/grpc/examples/helloworld/HelloReply.java b/examples/src/generated/main/java/io/grpc/examples/helloworld/HelloReply.java index 69017c71c3..a613ec31af 100644 --- a/examples/src/generated/main/java/io/grpc/examples/helloworld/HelloReply.java +++ b/examples/src/generated/main/java/io/grpc/examples/helloworld/HelloReply.java @@ -66,12 +66,12 @@ public final class HelloReply extends } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return io.grpc.examples.helloworld.HelloWorld.internal_static_helloworld_HelloReply_descriptor; + return io.grpc.examples.helloworld.HelloWorldProto.internal_static_helloworld_HelloReply_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return io.grpc.examples.helloworld.HelloWorld.internal_static_helloworld_HelloReply_fieldAccessorTable + return io.grpc.examples.helloworld.HelloWorldProto.internal_static_helloworld_HelloReply_fieldAccessorTable .ensureFieldAccessorsInitialized( io.grpc.examples.helloworld.HelloReply.class, io.grpc.examples.helloworld.HelloReply.Builder.class); } @@ -224,12 +224,12 @@ public final class HelloReply extends io.grpc.examples.helloworld.HelloReplyOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return io.grpc.examples.helloworld.HelloWorld.internal_static_helloworld_HelloReply_descriptor; + return io.grpc.examples.helloworld.HelloWorldProto.internal_static_helloworld_HelloReply_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return io.grpc.examples.helloworld.HelloWorld.internal_static_helloworld_HelloReply_fieldAccessorTable + return io.grpc.examples.helloworld.HelloWorldProto.internal_static_helloworld_HelloReply_fieldAccessorTable .ensureFieldAccessorsInitialized( io.grpc.examples.helloworld.HelloReply.class, io.grpc.examples.helloworld.HelloReply.Builder.class); } @@ -257,7 +257,7 @@ public final class HelloReply extends public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return io.grpc.examples.helloworld.HelloWorld.internal_static_helloworld_HelloReply_descriptor; + return io.grpc.examples.helloworld.HelloWorldProto.internal_static_helloworld_HelloReply_descriptor; } public io.grpc.examples.helloworld.HelloReply getDefaultInstanceForType() { diff --git a/examples/src/generated/main/java/io/grpc/examples/helloworld/HelloRequest.java b/examples/src/generated/main/java/io/grpc/examples/helloworld/HelloRequest.java index 03a8506a2f..e96df7c36e 100644 --- a/examples/src/generated/main/java/io/grpc/examples/helloworld/HelloRequest.java +++ b/examples/src/generated/main/java/io/grpc/examples/helloworld/HelloRequest.java @@ -66,12 +66,12 @@ public final class HelloRequest extends } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return io.grpc.examples.helloworld.HelloWorld.internal_static_helloworld_HelloRequest_descriptor; + return io.grpc.examples.helloworld.HelloWorldProto.internal_static_helloworld_HelloRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return io.grpc.examples.helloworld.HelloWorld.internal_static_helloworld_HelloRequest_fieldAccessorTable + return io.grpc.examples.helloworld.HelloWorldProto.internal_static_helloworld_HelloRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( io.grpc.examples.helloworld.HelloRequest.class, io.grpc.examples.helloworld.HelloRequest.Builder.class); } @@ -224,12 +224,12 @@ public final class HelloRequest extends io.grpc.examples.helloworld.HelloRequestOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return io.grpc.examples.helloworld.HelloWorld.internal_static_helloworld_HelloRequest_descriptor; + return io.grpc.examples.helloworld.HelloWorldProto.internal_static_helloworld_HelloRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return io.grpc.examples.helloworld.HelloWorld.internal_static_helloworld_HelloRequest_fieldAccessorTable + return io.grpc.examples.helloworld.HelloWorldProto.internal_static_helloworld_HelloRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( io.grpc.examples.helloworld.HelloRequest.class, io.grpc.examples.helloworld.HelloRequest.Builder.class); } @@ -257,7 +257,7 @@ public final class HelloRequest extends public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return io.grpc.examples.helloworld.HelloWorld.internal_static_helloworld_HelloRequest_descriptor; + return io.grpc.examples.helloworld.HelloWorldProto.internal_static_helloworld_HelloRequest_descriptor; } public io.grpc.examples.helloworld.HelloRequest getDefaultInstanceForType() { diff --git a/examples/src/generated/main/java/io/grpc/examples/helloworld/HelloWorld.java b/examples/src/generated/main/java/io/grpc/examples/helloworld/HelloWorldProto.java similarity index 93% rename from examples/src/generated/main/java/io/grpc/examples/helloworld/HelloWorld.java rename to examples/src/generated/main/java/io/grpc/examples/helloworld/HelloWorldProto.java index bdbbced3e0..03e1e6e038 100644 --- a/examples/src/generated/main/java/io/grpc/examples/helloworld/HelloWorld.java +++ b/examples/src/generated/main/java/io/grpc/examples/helloworld/HelloWorldProto.java @@ -3,8 +3,8 @@ package io.grpc.examples.helloworld; -public final class HelloWorld { - private HelloWorld() {} +public final class HelloWorldProto { + private HelloWorldProto() {} public static void registerAllExtensions( com.google.protobuf.ExtensionRegistry registry) { } @@ -31,8 +31,8 @@ public final class HelloWorld { "equest\022\014\n\004name\030\001 \001(\t\"\035\n\nHelloReply\022\017\n\007me" + "ssage\030\001 \001(\t2I\n\007Greeter\022>\n\010SayHello\022\030.hel" + "loworld.HelloRequest\032\026.helloworld.HelloR" + - "eply\"\000B1\n\033io.grpc.examples.helloworldB\nH" + - "elloWorldP\001\242\002\003HLWb\006proto3" + "eply\"\000B6\n\033io.grpc.examples.helloworldB\017H" + + "elloWorldProtoP\001\242\002\003HLWb\006proto3" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { diff --git a/examples/src/main/proto/helloworld.proto b/examples/src/main/proto/helloworld.proto index fe52c8e663..0bee1fcfcf 100644 --- a/examples/src/main/proto/helloworld.proto +++ b/examples/src/main/proto/helloworld.proto @@ -31,7 +31,7 @@ syntax = "proto3"; option java_multiple_files = true; option java_package = "io.grpc.examples.helloworld"; -option java_outer_classname = "HelloWorld"; +option java_outer_classname = "HelloWorldProto"; option objc_class_prefix = "HLW"; package helloworld;