Inlcude the file that was used to generate service descriptors
diff --git a/compiler/src/java_plugin/cpp/java_generator.cpp b/compiler/src/java_plugin/cpp/java_generator.cpp
index cdb17c0..8be1575 100644
--- a/compiler/src/java_plugin/cpp/java_generator.cpp
+++ b/compiler/src/java_plugin/cpp/java_generator.cpp
@@ -639,10 +639,13 @@
Printer* p,
bool generate_nano) {
(*vars)["service_name"] = service->name();
+ (*vars)["file_name"] = service->file()->name();
(*vars)["service_class_name"] = ServiceClassName(service);
p->Print(
*vars,
- "@$Generated$(\"by gRPC proto compiler\")\n"
+ "@$Generated$(\n"
+ " value = \"by gRPC proto compiler\",\n"
+ " comments = \"Source: $file_name$\")\n"
"public class $service_class_name$ {\n\n");
p->Indent();
p->Print(
diff --git a/compiler/src/test/golden/TestService.java.txt b/compiler/src/test/golden/TestService.java.txt
index 904963e..3dbaa26 100644
--- a/compiler/src/test/golden/TestService.java.txt
+++ b/compiler/src/test/golden/TestService.java.txt
@@ -13,7 +13,9 @@
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
-@javax.annotation.Generated("by gRPC proto compiler")
+@javax.annotation.Generated(
+ value = "by gRPC proto compiler",
+ comments = "Source: test.proto")
public class TestServiceGrpc {
private TestServiceGrpc() {}
diff --git a/compiler/src/test/golden/TestServiceNano.java.txt b/compiler/src/test/golden/TestServiceNano.java.txt
index 4d8d1ba..b310d92 100644
--- a/compiler/src/test/golden/TestServiceNano.java.txt
+++ b/compiler/src/test/golden/TestServiceNano.java.txt
@@ -15,7 +15,9 @@
import java.io.IOException;
-@javax.annotation.Generated("by gRPC proto compiler")
+@javax.annotation.Generated(
+ value = "by gRPC proto compiler",
+ comments = "Source: test.proto")
public class TestServiceGrpc {
private TestServiceGrpc() {}