File tree Expand file tree Collapse file tree
main/java/com/palantir/javaformat/java
test/java/com/palantir/javaformat/java Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -154,7 +154,9 @@ public boolean isSlashStarComment() {
154154
155155 @ Override
156156 public boolean isJavadocComment () {
157- return text .startsWith ("/**" ) && text .length () > 4 ;
157+ // comments like `/***` are also javadoc, but their formatting probably won't be improved
158+ // by the javadoc formatter
159+ return text .startsWith ("/**" ) && text .charAt ("/**" .length ()) != '*' && text .length () > 4 ;
158160 }
159161
160162 @ Override
Original file line number Diff line number Diff line change @@ -55,11 +55,28 @@ public void empty() {
5555 "class Test {}" ,
5656 };
5757 String [] expected = {
58- "/** */" , "class Test {}" ,
58+ "/***/" , "class Test {}" ,
5959 };
6060 doFormatTest (input , expected );
6161 }
6262
63+ @ Test
64+ public void bannerCommentIsNotJavadoc () {
65+ // A comment that opens with three or more asterisks is left to the plain comment handling: reflowing it as
66+ // javadoc would push the asterisks onto a line of their own and turn its paragraphs into <p> tags.
67+ String [] input = {
68+ "/****************************************" ,
69+ " * Copyright" ,
70+ " *" ,
71+ " * Some" ,
72+ " *" ,
73+ " * Company" ,
74+ " ****************************************/" ,
75+ "class Test {}" ,
76+ };
77+ doFormatTest (input , input );
78+ }
79+
6380 @ Test
6481 public void emptyMultipleLines () {
6582 String [] input = {
You can’t perform that action at this time.
0 commit comments