Community
Participate
Working Groups
Build ID: M20080911-1700 Steps To Reproduce: 1. Edit a javadoc comment with tags that contain {@code ...} elements. Example : /** * Comments that can be formated in several lines... * * @author Myself * * @version {@code $Revision: 1.2 $ $Date: 2009/01/07 12:27:50 $ $Author: myself $ $Source: /projects/cvs/module/project/src/com/foo/Main.java,v $} */ 2. Format the code. 3. The version tag value is broken, since the formatter splits the line : /** * Comments that can be formated in several lines... * * @author Myself * * @version {@code $Revision: 1.2 $ $Date: 2009/01/07 12:27:50 $ $Author: myself * $ $Source: /projects/cvs/module/project/src/com/foo/Main.java,v $} */ More information: Older versions (3.3 Europa, for example) handles the special {@code ...} sequence without splitting the value into multiple lines...
There's no specification saying that the @version tag should be kept on one line and splitting the @code text in two lines does not really break it. But I agree that, since 3.3, there's an inconsistency between in-line @code tag and <code>...</code> HTML tags formatting although it is specified that {@code} is equivalent to <code>{@literal}</code>... However, replacing @code in-line tag by <code> HTML tag is not a possible workaround as this produces the following output: /** * Comments that can be formated in several lines... * * @author Myself * * @version * * <code>$Revision: 1.2 $ $Date: 2009/01/07 12:27:50 $ $Author:myself $ $Source: /projects/cvs/module/project/src/com/foo/Main.java,v $</code> */ public class X02 { } The formatter should not split the line in this case...
Created attachment 139842 [details] Proposed patch Add the notion of immutable block based on the tag value (currently only @code).
You might want to add the same support for @literal. See http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/javadoc.html#{@code}
Created attachment 158645 [details] New complete patch This patch addresses the initial issue but also remove all differences with 3.3 behavior in this area... :-) It also considers @literal inline tag as immutable.
Created attachment 158835 [details] Final patch Final patch fixing one minor issue when the inline tag closing brace is at max column + 1...
Created attachment 158838 [details] Final patch (without whitespaces noise...) Previous patch wrongly included white spaces cleaning although I didn't want to do it... It seems that something went wrong with the Save Actions...
Created attachment 158839 [details] Released patch One more additional change in a Javadoc comment...
Released for 3.6M6 in HEAD stream.
Created attachment 159072 [details] Additional patch This additional patch fixes some minor issues with the line length computation while formatting an immutable block. It also changes the initial tests as the $Revision, $Date, etc. were meaningful for CVS and was changed at each check-out!
(In reply to comment #9) > Created an attachment (id=159072) [details] > Additional patch > Released for 3.6M6
Verified for 3.6M6 using build I20100305-1011