Search code examples
eclipsecode-generationjavadocwekaeclipse-jdt

Disabling Eclipse code formatting for part of a javadoc


I have a Java class for which part of the javadoc is actually generated as part of the build process: the return value of a method (a static String value) is inserted into the source file, much like $Revision: $ tags work in some version control software.

While this behaviour may be questionable, such duplication of information is required by the framework I use (WEKA machine learning library). I would like Eclipse's code formatter not to interfere with the generated comments. I am using the Eclipse Indigo release.

I can turn the formatter on/off with special comments //@formatter:on and //@formatter:off. However, the @formatter tags are only functional in 'normal' comments, not in javadoc comments. Obviously, they could be easily confused for javadoc tags. This means I cannot turn off the formatter (for example, automatic line breaking) for the generated part of the javadoc comment, and leave it on for the rest, because the @formatter directives must be placed around the javadoc comment.

It there a workaround to toggle code formatting inside javadoc comments?


Solution

  • You can disable formatting for the header, but I don't believe you can selectively disable formatting for nonheader javadoc comments.