Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,11 @@ private static String stripJavadocBeginAndEnd(String input) {
*/
checkArgument(input.startsWith("/**"), "Missing /**: %s", input);
checkArgument(input.endsWith("*/") && input.length() > 4, "Missing */: %s", input);
return input.substring("/**".length(), input.length() - "*/".length());
int end = input.length() - "*/".length();
while (end > "/**".length() && input.charAt(end - 1) == '*') {
end--;
}
return input.substring("/**".length(), end);
}

private final CharStream input;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,35 @@ void significantAsterisks() {
doFormatTest(input, expected);
}

@Test
void trailingAsterisksBeforeClose() {
String[] input = {
"/** Version information for all the QuotaKeys that we have data for **/", //
"class Test {}",
};
String[] expected = {
"/** Version information for all the QuotaKeys that we have data for */", //
"class Test {}",
};
doFormatTest(input, expected);
}

@Test
void trailingAsterisksOnTheirOwnLine() {
String[] input = {
"/**", //
" * Summary line",
" * continues here.",
" ***/",
"class Test {}",
};
String[] expected = {
"/** Summary line continues here. */", //
"class Test {}",
};
doFormatTest(input, expected);
}

@Test
void links() {
String[] input = {
Expand Down
Loading