'Checkstyle Warning Eclipse "Javadoc tag should be preceded with an empty line" even though there is one
I use Checkstyle (Google Checks) in Eclipse, and for every Javadoc tag, the compiler shows the warning "Javadoc tag should be preceded with an empty line" even though there is one. The only way to remove the warning is to introduce an HTML line break balise.
For example:
/**
* shows drinks units in fridge.
*
* @return amount of drinks in fridge.
*/
The compiler will give a warning "Javadoc tag '@return' should be preceded with an empty line".
Of course it's possible to deactivate the warning in Checkstyle, however I still would like to know why the compiler does that. My teacher and classmates do not have that warning even without a line break balise, and they have no idea why I have it, and on the sourceforge page of Checkstyle (https://checkstyle.sourceforge.io/apidocs/com/puppycrawl/tools/checkstyle/checks/javadoc/RequireEmptyLineBeforeBlockTagGroupCheck.html) , HTML balises are also not required.
Thanks for your help !
Solution 1:[1]
I realized that it's because Eclipse automatically inserts a space after the asterisk when you press enter (which makes sense if you're going to write something on the line) but doesn't remove it when you press enter again. So the line preceding the Javadoc tag is actually: <leading indentation>*<space>. Deleting this space manually removes the Checkstyle warning for me.
Maybe someone else knows how to configure Eclipse to automatically remove this space. Personally, I'm stuck using Google's XML formatter profile because their google-java-format Eclipse plugin doesn't work (unhandled exception). Perhaps the google-java-format would fix this.
Solution 2:[2]
My solustion is
Search \* $ with regular expressions, and replace all with just *.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | WD40 |
| Solution 2 | deadlord |
