@@ -1116,7 +1116,8 @@ static void PrintService(const ServiceDescriptor* service,
11161116 std::map<std::string, std::string>* vars,
11171117 Printer* p,
11181118 ProtoFlavor flavor,
1119- bool disable_version) {
1119+ bool disable_version,
1120+ GeneratedAnnotation generated_annotation) {
11201121 (*vars)[" service_name" ] = service->name ();
11211122 (*vars)[" file_name" ] = service->file ()->name ();
11221123 (*vars)[" service_class_name" ] = ServiceClassName (service);
@@ -1129,24 +1130,17 @@ static void PrintService(const ServiceDescriptor* service,
11291130 // TODO(nmittler): Replace with WriteServiceDocComment once included by protobuf distro.
11301131 GrpcWriteServiceDocComment (p, service, NONE);
11311132
1132- if ((*vars)[ " JakartaMode " ] == " javax " ) {
1133+ if (generated_annotation == GeneratedAnnotation::JAVAX ) {
11331134 p->Print (
11341135 *vars,
11351136 " @javax.annotation.Generated(\n "
11361137 " value = \" by gRPC proto compiler$grpc_version$\" ,\n "
11371138 " comments = \" Source: $file_name$\" )\n "
11381139 " @$GrpcGenerated$\n " );
1139- } else if ((*vars)[ " JakartaMode " ] == " omit " ) {
1140+ } else { // GeneratedAnnotation::OMIT
11401141 p->Print (
11411142 *vars,
11421143 " @$GrpcGenerated$\n " );
1143- } else {
1144- p->Print (
1145- *vars,
1146- " @javax.annotation.Generated(\n "
1147- " value = \" by gRPC proto compiler$grpc_version$\" ,\n "
1148- " comments = \" Source: $file_name$\" )\n "
1149- " @$GrpcGenerated$\n " );
11501144 }
11511145
11521146 if (service->options ().deprecated ()) {
@@ -1232,7 +1226,7 @@ void GenerateService(const ServiceDescriptor* service,
12321226 protobuf::io::ZeroCopyOutputStream* out,
12331227 ProtoFlavor flavor,
12341228 bool disable_version,
1235- std::string jakarta_mode ) {
1229+ GeneratedAnnotation generated_annotation ) {
12361230 // All non-generated classes must be referred by fully qualified names to
12371231 // avoid collision with generated classes.
12381232 std::map<std::string, std::string> vars;
@@ -1264,7 +1258,6 @@ void GenerateService(const ServiceDescriptor* service,
12641258 vars[" MethodDescriptor" ] = " io.grpc.MethodDescriptor" ;
12651259 vars[" StreamObserver" ] = " io.grpc.stub.StreamObserver" ;
12661260 vars[" Iterator" ] = " java.util.Iterator" ;
1267- vars[" JakartaMode" ] = jakarta_mode;
12681261 vars[" GrpcGenerated" ] = " io.grpc.stub.annotations.GrpcGenerated" ;
12691262 vars[" ListenableFuture" ] =
12701263 " com.google.common.util.concurrent.ListenableFuture" ;
@@ -1283,7 +1276,7 @@ void GenerateService(const ServiceDescriptor* service,
12831276 if (!vars[" Package" ].empty ()) {
12841277 vars[" Package" ].append (" ." );
12851278 }
1286- PrintService (service, &vars, &printer, flavor, disable_version);
1279+ PrintService (service, &vars, &printer, flavor, disable_version, generated_annotation );
12871280}
12881281
12891282std::string ServiceJavaPackage (const FileDescriptor* file) {
0 commit comments