Disabling Eclipse code formatting for part of a javadoc

Viewed 5452

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?

3 Answers

I encountered the same problem and changing @formatter:off to FORMATTEROFF did the trick for me.

the idea is to avoid using @ in the on/off tag.

Now I can disable the formatter around a part of a javadoc.

Related