Avoid all leading/trailing doc comments during codegen tests.

Prototiller has subtley different rules about attaching these to objects, and relatively harmless transformations can cause codegen diffs where these move around.

PiperOrigin-RevId: 608402666
pull/15874/head
Mike Kruskal 9 months ago committed by Copybara-Service
parent 6caac65375
commit 6c58b9a552
  1. 10
      src/google/protobuf/compiler/java/doc_comment.cc

@ -126,6 +126,12 @@ static void WriteDocCommentBodyForLocation(io::Printer* printer,
const SourceLocation& location,
const Options options,
const bool kdoc) {
if (options.strip_nonfunctional_codegen) {
// TODO: Remove once prototiller can avoid making
// extraneous formatting changes to comments.
return;
}
std::string comments = location.leading_comments.empty()
? location.trailing_comments
: location.leading_comments;
@ -147,9 +153,6 @@ static void WriteDocCommentBodyForLocation(io::Printer* printer,
printer->Print(" * <pre>\n");
}
// TODO: Remove once prototiller can avoid making
// extraneous formatting changes to comments.
if (!options.strip_nonfunctional_codegen) {
for (size_t i = 0; i < lines.size(); i++) {
// Lines should start with a single space and any extraneous leading
// spaces should be stripped. For lines starting with a /, the leading
@ -166,7 +169,6 @@ static void WriteDocCommentBodyForLocation(io::Printer* printer,
printer->Print(" *\n");
}
}
}
if (kdoc) {
printer->Print(" * ```\n");

Loading…
Cancel
Save