Community
Participate
Working Groups
I guess this problem exists since a long while as it was implemented like this in the code when comments formatting moved from JDT/Text to JDT/Core. The formatter consider 'code' tag as immutable which means that all the text located inside <code>...</code> is not formatted at all: all spaces between words are preserved and the text is not cut when it is over the max length line. However, looking at Javadoc tool behavior, it does not seem correct. While generating following example: public class X { /** * <p> * Text <code>immutable * tag written on * several lines and which * length is over the max length line specified in the preferences (e.g. 80 characters for Eclipse default build-in)</code> End */ void foo() { } } I got the following text in the generated X.html file: void foo() Text immutable tag written on several lines and which length is over the max length line specified in the preferences (e.g. 80 characters for Eclipse default build-in) End Note that the text inside the 'code' tag is displayed using the 'courier' font and the rest of the text is displayed with default browser font. Note also that the line is not cut, if I enlarged my window, I can see all the text on only one line! So, it sounds that we need to change this behavior on the javadoc formatter to be closer than the Javadoc formatting or add a preference to let user decide what to do in this case...
Note that the new comments formatter behaves differently than 3.3 when <pre> section is written inside a <code> section. Although the 3.3 comments formatter considers <code> section as immutable it formats the text contains in the <pre> section. As an example of this difference, the following test case using Eclipse built-in + 'Maximum line width for comments' = 40: public class X01 { /** * <code><pre>public class X {}</pre></code> */ void foo() { } } is formatted in 3.3 as: public class X01 { /** * <code><pre> * public class X { * } * </pre></code> */ void foo() { } } and is unchanged in 3.4RC1 considering that <code> is an immutable section, hence does not format anything between the <code>...</code> tags.
Note also that following test case: public class X02 { /** * Example of 'code' tag nested inside 'pre' tag: * <pre><code>public class X {}</code></pre> */ void foo() { } } is formatted as follow by the 3.4 formatter: public class X02 { /** * Example of 'code' tag nested * inside 'pre' tag: * * <pre> * <code>public class X {}</code> * </pre> */ void foo() { } } This seems to be wrong as: 1) the 3.3 formats it as: public class X02 { /** * Example of 'code' tag nested * inside 'pre' tag: * * <pre><code> * public class X { * } * </code></pre> */ void foo() { } } 2) Is generated by the javadoc tool as if there will be only a 'pre' tag In fact, as the <code> tag is not considered as immutable by the javadoc tool, in as soon as a 'pre' tag is present, it obfuscates the 'code' tag if there's one before or after it...
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.