02 Oct

Eclipse Code Formatter not formatting Javadocs properly

Today after developing a company formatter profile for developers to use on the Java source files, I ran into an interesting problem where the Eclipse Java Code Formatter was not obeying my rules. In particular, it appeared that it was not indenting the description following Javadoc @param tags nor adding a new line after the @param tags:


It also appeared to be related to my workspace; when adding my profile to a new workspace it worked as expected. However, I soon realized that the reason Eclipse was not processing my Javadoc comments was that I had set the Java Compiler > Javadoc to not process Javadoc comments. As such, if your code formatter rules appear to not be formatting Javadoc comments properly, double check to ensure your Java Compiler is set to process Javadoc comments in Eclipse (located under Window > Preferences > Java > Compiler > Javadoc):