Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions compiler/src/java_plugin/cpp/java_generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1135,13 +1135,16 @@ static void PrintService(const ServiceDescriptor* service,
*vars,
"@javax.annotation.Generated(\n"
" value = \"by gRPC proto compiler$grpc_version$\",\n"
" comments = \"Source: $file_name$\")\n"
"@$GrpcGenerated$\n");
} else { // GeneratedAnnotation::OMIT
" comments = \"Source: $file_name$\")\n");
} else if (generated_annotation == GeneratedAnnotation::JAKARTA) {
p->Print(
*vars,
"@$GrpcGenerated$\n");
"@jakarta.annotation.Generated(\n"
" value = \"by gRPC proto compiler$grpc_version$\",\n"
" comments = \"Source: $file_name$\")\n");
}
// Always include @GrpcGenerated
p->Print(*vars, "@$GrpcGenerated$\n");

if (service->options().deprecated()) {
p->Print(*vars, "@$Deprecated$\n");
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/java_plugin/cpp/java_generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ enum ProtoFlavor {
};

enum GeneratedAnnotation {
OMIT, JAVAX
OMIT, JAVAX, JAKARTA
};

// Returns the package name of the gRPC services defined in the given file.
Expand Down
2 changes: 2 additions & 0 deletions compiler/src/java_plugin/cpp/java_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ class JavaGrpcGenerator : public protobuf::compiler::CodeGenerator {
generated_annotation = java_grpc_generator::GeneratedAnnotation::OMIT;
} else if (options[i].second == "javax") {
generated_annotation = java_grpc_generator::GeneratedAnnotation::JAVAX;
} else if (options[i].second == "jakarta") {
generated_annotation = java_grpc_generator::GeneratedAnnotation::JAKARTA;
}
}
}
Expand Down