我想:
/**
* @param from a point belonging to the map
* @param to a point belonging to the map
* @return a list of weighted edges on the shortest path from
* {@code from} to {@code to}
*/
但是eclipse给了我:
/**
* @param from a point belonging to the map
* @param to a point belonging to the map
* @return a list of weighted edges on the shortest path from {@code from}
* to {@code to}
*/
有没有办法改变这个?
答案 0 :(得分:3)
添加< br>
/** * @param from * a point belonging to the map * @param to * a point belonging to the map * @return a list of weighted edges on the shortest path from<br> * {@code from} to {@code to} */
Eclipse将为每个&lt; br&gt;包含一个换行符。另外,当您使用Eclipse生成JavaDoc时,它还包括强制换行符。
获得修复格式的另一种方法是&lt; pre&gt; &LT; /预&GT;标签
/** * Some Comments * * <pre> * Hello * World * </pre> * * @param toTest * @return ... */
&lt; pre&gt;的一个问题是你在开幕之前有一个强制换行符&lt; pre&gt;并在结束后&lt; / pre&gt;标签,这意味着它不能与@return,@ param,...
一起使用注意:&lt; pre&gt;和&lt; br&gt;仅适用于JavaDoc-Comments / **。在正常的块注释/ *中,这两个被eclipse忽略。
答案 1 :(得分:2)
当然,在eclipse中,转到Windows,首选项,Java&gt; Code Style&gt; Formatter,然后单击编辑。然后查找要修改的注释并添加选项卡。
那就是说,你确定要这么做吗?请考虑guidelines,更不用说现在或将来,一些解析器可能无法找到您的javadoc,并且一些程序员可能对您非常恼火;)
编辑:哦:/我担心你是对的;我在想Java&gt; CodeStyle&gt; CodeTemplates,它会在创建方法/类时放置你想要的任何东西。然而,autoformatter不会尊重这一点:(