@@ -1116,7 +1116,8 @@ static void PrintService(const ServiceDescriptor* service,
1116
1116
std::map<std::string, std::string>* vars,
1117
1117
Printer* p,
1118
1118
ProtoFlavor flavor,
1119
- bool disable_version) {
1119
+ bool disable_version,
1120
+ GeneratedAnnotation generated_annotation) {
1120
1121
(*vars)[" service_name" ] = service->name ();
1121
1122
(*vars)[" file_name" ] = service->file ()->name ();
1122
1123
(*vars)[" service_class_name" ] = ServiceClassName (service);
@@ -1129,24 +1130,17 @@ static void PrintService(const ServiceDescriptor* service,
1129
1130
// TODO(nmittler): Replace with WriteServiceDocComment once included by protobuf distro.
1130
1131
GrpcWriteServiceDocComment (p, service, NONE);
1131
1132
1132
- if ((*vars)[ " JakartaMode " ] == " javax " ) {
1133
+ if (generated_annotation == GeneratedAnnotation::JAVAX ) {
1133
1134
p->Print (
1134
1135
*vars,
1135
1136
" @javax.annotation.Generated(\n "
1136
1137
" value = \" by gRPC proto compiler$grpc_version$\" ,\n "
1137
1138
" comments = \" Source: $file_name$\" )\n "
1138
1139
" @$GrpcGenerated$\n " );
1139
- } else if ((*vars)[ " JakartaMode " ] == " omit " ) {
1140
+ } else { // GeneratedAnnotation::OMIT
1140
1141
p->Print (
1141
1142
*vars,
1142
1143
" @$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
1144
}
1151
1145
1152
1146
if (service->options ().deprecated ()) {
@@ -1232,7 +1226,7 @@ void GenerateService(const ServiceDescriptor* service,
1232
1226
protobuf::io::ZeroCopyOutputStream* out,
1233
1227
ProtoFlavor flavor,
1234
1228
bool disable_version,
1235
- std::string jakarta_mode ) {
1229
+ GeneratedAnnotation generated_annotation ) {
1236
1230
// All non-generated classes must be referred by fully qualified names to
1237
1231
// avoid collision with generated classes.
1238
1232
std::map<std::string, std::string> vars;
@@ -1264,7 +1258,6 @@ void GenerateService(const ServiceDescriptor* service,
1264
1258
vars[" MethodDescriptor" ] = " io.grpc.MethodDescriptor" ;
1265
1259
vars[" StreamObserver" ] = " io.grpc.stub.StreamObserver" ;
1266
1260
vars[" Iterator" ] = " java.util.Iterator" ;
1267
- vars[" JakartaMode" ] = jakarta_mode;
1268
1261
vars[" GrpcGenerated" ] = " io.grpc.stub.annotations.GrpcGenerated" ;
1269
1262
vars[" ListenableFuture" ] =
1270
1263
" com.google.common.util.concurrent.ListenableFuture" ;
@@ -1283,7 +1276,7 @@ void GenerateService(const ServiceDescriptor* service,
1283
1276
if (!vars[" Package" ].empty ()) {
1284
1277
vars[" Package" ].append (" ." );
1285
1278
}
1286
- PrintService (service, &vars, &printer, flavor, disable_version);
1279
+ PrintService (service, &vars, &printer, flavor, disable_version, generated_annotation );
1287
1280
}
1288
1281
1289
1282
std::string ServiceJavaPackage (const FileDescriptor* file) {
0 commit comments