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 @@ -154,7 +154,9 @@ public boolean isSlashStarComment() {

@Override
public boolean isJavadocComment() {
return text.startsWith("/**") && text.length() > 4;
// comments like `/***` are also javadoc, but their formatting probably won't be improved
// by the javadoc formatter
return text.startsWith("/**") && text.charAt("/**".length()) != '*' && text.length() > 4;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,28 @@ public void empty() {
"class Test {}",
};
String[] expected = {
"/** */", "class Test {}",
"/***/", "class Test {}",
};
doFormatTest(input, expected);
}

@Test
public void bannerCommentIsNotJavadoc() {
// A comment that opens with three or more asterisks is left to the plain comment handling: reflowing it as
// javadoc would push the asterisks onto a line of their own and turn its paragraphs into <p> tags.
String[] input = {
"/****************************************",
" * Copyright",
" *",
" * Some",
" *",
" * Company",
" ****************************************/",
"class Test {}",
};
doFormatTest(input, input);
}

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