1. Eclipse -> Preferences ->Java -> Code Style -> Formatter, 点击 "Edit" -> Comments, 在General Setting里面取消 "Enable javadoc comment formatting."
2. Eclipse -> Preferences ->Java -> Code Style -> Formatter, 点击 "Edit" -> Off/On Tags, 勾选"Enable off/On tags".
然后在代码中不想被format的地方, 前后分别加上 @formatter:off
和 @formatter:on
3. 在*号后面用-, 这样也能起到这个效果, 不过不推荐, 因为这样的话, 你的这个函数的javadoc就生成不出来.
/*- * Here is a block comment with some very special * formatting that I want indent(1) to ignore. * * one * two * three */
4. 同第2个方法, <pre> </pre>
, 可以使用<pre>, 我个人比较喜欢使用这种.
参考Link:
http://stackoverflow.com/questions/1024886/making-eclipses-java-code-formatter-ignore-comments