This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 49728 - [tests] Bad format of javadoc text
Summary: [tests] Bad format of javadoc text
Status: CLOSED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 4.x
Hardware: PC Linux
: P3 blocker (vote)
Assignee: Pavel Flaska
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-09-30 11:02 UTC by ehucka
Modified: 2007-09-26 09:14 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ehucka 2004-09-30 11:02:36 UTC
Code like:

ClassElement ce...
ce.getJavaDoc().getRawText();

returns text with different format.

Comment like:
"/** Class comment */" is parsed: " Class comment
\n". There were not the first space and the new
line at the end of the comment text.
Comment 1 Pavel Flaska 2004-09-30 11:14:48 UTC
Caused by integration of #48568 - Fixed JavaDoc when there aren't
stars on every line. See issue details.
Are the new lines at the end of javadoc always duplicated, i.e.
/** line 1
  * line 2
  */
contains two new lines at the end?

The space before comment is left now intentionally. What to do if the
comment is written without space, i.e. "/**Class comment */"?
Comment 2 ehucka 2004-09-30 11:57:45 UTC
Comment:

/**
 * comment
 */

is returned as "\s\n\scomment\n\s\n" or comment

/**
 * line1
 * line2
 */

is returned like "\s\nline1\n\sline2\n\s\s\s\s\s\n".

I think the lines should be trimed. JavaDoc is transformed into HTML
and many spaces are redundant there - are transformed into one space
or a new line.
The first empty line is redundant too. There is not any information.
The last new line and spaces before it are incorrect.
Comment 3 ehucka 2004-09-30 12:00:08 UTC
I missed, the second string is formated:
"\s\n\sline1\n\sline2\n\s\s\s\s\s\n".
Comment 4 Martin Matula 2004-09-30 14:53:13 UTC
Assigning to Pavel.
Comment 5 Pavel Flaska 2004-09-30 15:12:06 UTC
We can remove leading and trailing new lines and spaces, but not for
all lines. We can do that only at the beginning and end of javadoc. Do
you think that it is enough?
Comment 6 ehucka 2004-10-01 08:19:55 UTC
I think there is an inconsistance. Try to run Auto Comment tool to
some class. Select a method and add a multiline comment:

line1
line2

in appropriate "JavaDoc Comment Text" textarea. Go back to the source
file, there is new comment:

/**
 * line1
 * line2
 */

Correct.
But if you run Auto Comment Tool next time and check content of the
textarea for the method. There is text:

 line1
 line2

 - new spaces before each line. If you make a change of this comment
another spaces will be add to the begins of all lines etc.
Comment 7 Pavel Flaska 2004-10-01 16:12:31 UTC
Fixed extra new line at the end. Other things mentioned in this issue
are not changed intentionaly. Get JavaDoc text does not guarantee any
formatting functionality, it is only rough text. Please, see issue
#48568, where spaces at the begining of line are important (when there
are HTML tags inside.)

Checking in src/org/netbeans/modules/javacore/parser/ASTProvider.java;
/cvs/java/javacore/src/org/netbeans/modules/javacore/parser/ASTProvider.java,v
 <--  ASTProvider.java
new revision: 1.22; previous revision: 1.21
done
Comment 8 Pavel Flaska 2004-10-04 14:19:27 UTC
Eliminate redundant spaces after asterisk in javadoc. Now it works
exactly as in 3.6. If you want to change behaviour of autocomment
tool, please, file a separate issue against it. (It has to be solved
at level of tool. Model impl cannot solve formatting issues as it is
not only autocomment tool service.)

Checking in src/org/netbeans/modules/javacore/parser/JavaDocParser.java;
/cvs/java/javacore/src/org/netbeans/modules/javacore/parser/JavaDocParser.java,v
 <--  JavaDocParser.java
new revision: 1.10; previous revision: 1.9
done
Comment 9 ehucka 2004-10-05 12:48:32 UTC
It doesn't work now again.

/**
 * Comment
 * Comment2 
 */

is returned like: "\s\sComment\sComment2" - two spaces at the begin
and no new lines.
Comment 10 Pavel Flaska 2004-10-05 15:30:10 UTC
Finally fixed. Added test for trim to javacore/test/unit. Please
verify. Thanks.

Checking in src/org/netbeans/modules/javacore/parser/ASTProvider.java;
/cvs/java/javacore/src/org/netbeans/modules/javacore/parser/ASTProvider.java,v
 <--  ASTProvider.java
new revision: 1.25; previous revision: 1.24
done
Processing log script arguments...
More commits to come...
Checking in test/cfg-unit.xml;
/cvs/java/javacore/test/cfg-unit.xml,v  <--  cfg-unit.xml
new revision: 1.18; previous revision: 1.17
done
Processing log script arguments...
More commits to come...
RCS file:
/cvs/java/javacore/test/unit/data/projects/default/src/org/netbeans/test/getters/JavaDocText.java,v
done
Checking in
test/unit/data/projects/default/src/org/netbeans/test/getters/JavaDocText.java;
/cvs/java/javacore/test/unit/data/projects/default/src/org/netbeans/test/getters/JavaDocText.java,v
 <--  JavaDocText.java
initial revision: 1.1
done
Processing log script arguments...
More commits to come...
RCS file:
/cvs/java/javacore/test/unit/src/org/netbeans/jmi/javamodel/getters/JavaDocTextTest.java,v
done
Checking in
test/unit/src/org/netbeans/jmi/javamodel/getters/JavaDocTextTest.java;
/cvs/java/javacore/test/unit/src/org/netbeans/jmi/javamodel/getters/JavaDocTextTest.java,v
 <--  JavaDocTextTest.java
initial revision: 1.1
done
Processing log script arguments...
Comment 11 ehucka 2004-10-11 14:43:30 UTC
It would be better to let the first line as others - javadoc begins
after the last '*' of the comment sign or from the begin of line if
the '*' is not there.
Comment 12 Pavel Flaska 2004-10-12 14:59:20 UTC
My last attempt to fix this issue ;-). I tried now to leave the text
as raw as possible (remove only javadoc begin and end and leading
asterisks on every line, if it is there.) Added test too. Emane, can
you give me info how I can run your tests? -- Bear in mind, that
getRawText() provides (as in its name) raw text. It is up to client to
 format the provided text, if he need it formatted. Feel free to open
bugs against the different clients. The most important client is now
'javadoc completion window' in editor, which shows html. Because of
intesive use of it, we need to leave this call as fast and simple as
possible. If you need more structured information, used parsed javadoc
instead of text representation.

Checking in src/org/netbeans/modules/javacore/parser/ASTProvider.java;
/cvs/java/javacore/src/org/netbeans/modules/javacore/parser/ASTProvider.java,v
 <--  ASTProvider.java
new revision: 1.28; previous revision: 1.27
done
Processing log script arguments...
More commits to come...
Checking in
test/unit/data/projects/default/src/org/netbeans/test/getters/JavaDocText.java;
/cvs/java/javacore/test/unit/data/projects/default/src/org/netbeans/test/getters/JavaDocText.java,v
 <--  JavaDocText.java
new revision: 1.2; previous revision: 1.1
done
Processing log script arguments...
More commits to come...
Checking in
test/unit/src/org/netbeans/jmi/javamodel/getters/JavaDocTextTest.java;
/cvs/java/javacore/test/unit/src/org/netbeans/jmi/javamodel/getters/JavaDocTextTest.java,v
 <--  JavaDocTextTest.java
new revision: 1.2; previous revision: 1.1
done
Processing log script arguments...
Comment 13 ehucka 2004-11-05 09:54:49 UTC
verified
Comment 14 Quality Engineering 2007-09-20 12:07:48 UTC
Reorganization of java component