Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 51691 - [formatter] Formatter does not follow Javadoc 1.4 spec's asterisk rule
Summary: [formatter] Formatter does not follow Javadoc 1.4 spec's asterisk rule
Status: VERIFIED DUPLICATE of bug 303519
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: All All
: P5 minor (vote)
Target Milestone: 4.14 M3   Edit
Assignee: Mateusz Matela CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-02-11 12:54 EST by Alexander Staubo CLA
Modified: 2019-11-21 00:49 EST (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Staubo CLA 2004-02-11 12:54:48 EST
According to the Javadoc spec (relevant section:
http://java.sun.com/j2se/1.4.2/docs/tooldocs/solaris/javadoc.html#leadingasterisks):

"... Starting with 1.4, if you omit the leading asterisk on a line, the leading
white space is no longer removed. This enables you to paste code examples
directly into a doc comment inside a <PRE> tag, and its indentation will be
honored. Spaces are generally interpreted by browsers more uniformly than tabs.
Indentation is relative to the left margin (rather than the separator /** or
<PRE> tag)."

Eclipse ignores this. So:

  /**
    This
    is
             a
             preformatted
        comment!
  */

becomes

  /**
   * This is a preformatted comment!
   */
Comment 1 Gunnar Wagenknecht CLA 2004-12-21 06:17:21 EST
According to the document (link posted in the inital comment) and the quoted 
text, this looks correct to me. The provided example is not a preformatted 
comment and should be formatted according to the current behavior.

The question is, how should the following comment be formatted?

  /**
    This
    is comment
    <pre>
             with
             preformatted
        text!
    </pre>
  */

My suggestion:

  /**
   * This is a preformatted comment
   * <pre>
             with
             preformatted
        text!
   * </pre>
   */

Mhm.
Comment 2 Sebastian Davids CLA 2004-12-21 08:44:58 EST
One should be able to turn on/off this behavior.

Personally I like the way that *'ses will added.

If you want preformatting use <pre> ... and wait for bug 52921 get fixed.
Comment 3 Dani Megert CLA 2005-10-10 12:10:22 EDT
Ownership changed.
Comment 4 Frederic Fusier CLA 2008-08-18 08:06:26 EDT
Ownership has changed for the formatter, but I surely will not have enough time to fix your bug during the 3.5 development process, hence set its priority to P5.
Please provide a patch if you definitely need the bug to be fixed in this version and I'll have a look at it...
TIA
Comment 5 Eclipse Genie CLA 2019-10-12 11:55:53 EDT
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.
Comment 6 Mateusz Matela CLA 2019-10-21 15:44:46 EDT
Since the formatter redesign it works as suggested in comment 1.

Keeping the whitespace without <pre>, as suggested in comment 0, doesn't make sense because the resulting javadoc will not show it anyway.

Comment 2 suggested a setting for this and indeed there's no easy way to have asterisks added if a preformatted section was pasted without them. The fastest way I found is to toggle block selection mode to manually add asterisks in all lines. But that's a subject for another bug report.

*** This bug has been marked as a duplicate of bug 303519 ***
Comment 7 Jay Arthanareeswaran CLA 2019-11-21 00:49:57 EST
Verified for 4.14 M3 using build I20191119-1250