@@ -1128,12 +1128,26 @@ static void PrintService(const ServiceDescriptor* service,
11281128 #endif
11291129 // TODO(nmittler): Replace with WriteServiceDocComment once included by protobuf distro.
11301130 GrpcWriteServiceDocComment (p, service, NONE);
1131- p->Print (
1132- *vars,
1133- " @$Generated$(\n "
1134- " value = \" by gRPC proto compiler$grpc_version$\" ,\n "
1135- " comments = \" Source: $file_name$\" )\n "
1136- " @$GrpcGenerated$\n " );
1131+
1132+ if ((*vars)[" JakartaMode" ] == " javax" ) {
1133+ p->Print (
1134+ *vars,
1135+ " @javax.annotation.Generated(\n "
1136+ " value = \" by gRPC proto compiler$grpc_version$\" ,\n "
1137+ " comments = \" Source: $file_name$\" )\n "
1138+ " @$GrpcGenerated$\n " );
1139+ } else if ((*vars)[" JakartaMode" ] == " omit" ) {
1140+ p->Print (
1141+ *vars,
1142+ " @$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 " );
1150+ }
11371151
11381152 if (service->options ().deprecated ()) {
11391153 p->Print (*vars, " @$Deprecated$\n " );
@@ -1217,7 +1231,8 @@ void PrintImports(Printer* p) {
12171231void GenerateService (const ServiceDescriptor* service,
12181232 protobuf::io::ZeroCopyOutputStream* out,
12191233 ProtoFlavor flavor,
1220- bool disable_version) {
1234+ bool disable_version,
1235+ std::string jakarta_mode) {
12211236 // All non-generated classes must be referred by fully qualified names to
12221237 // avoid collision with generated classes.
12231238 std::map<std::string, std::string> vars;
@@ -1249,7 +1264,7 @@ void GenerateService(const ServiceDescriptor* service,
12491264 vars[" MethodDescriptor" ] = " io.grpc.MethodDescriptor" ;
12501265 vars[" StreamObserver" ] = " io.grpc.stub.StreamObserver" ;
12511266 vars[" Iterator" ] = " java.util.Iterator" ;
1252- vars[" Generated " ] = " javax.annotation.Generated " ;
1267+ vars[" JakartaMode " ] = jakarta_mode ;
12531268 vars[" GrpcGenerated" ] = " io.grpc.stub.annotations.GrpcGenerated" ;
12541269 vars[" ListenableFuture" ] =
12551270 " com.google.common.util.concurrent.ListenableFuture" ;
0 commit comments