Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 383942

Summary: [formatter] Javadoc formatter bugs (extra whitespaces and wrapped periods)
Product: [Eclipse Project] JDT Reporter: Joerg Hohwiller <joerg>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 4.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
The exported formatter settings
none
The original source code
none
The original source code after removing formatter off/on tags and formatting none

Description Joerg Hohwiller CLA 2012-06-29 17:01:18 EDT
Build Identifier: I20120608-1400

There are various existing issues for the formatter. In this issue, I will concentrate on formatting JavaDoc and only on the problems that are both nasty as well as quite easy to confirm and potentially easy to fix (tough I do not have a clue about the Eclipse codebase):
1. The formatter is always adding a whitespace after {@value}
2. The formatter wraps periods

I will attach:
* my exported formatter settings
* an example java source file
* the source file after formatter


Reproducible: Always

Steps to Reproduce:
1. Use attached sourcecode
2. Remove formatter:off comment
3. Format the sourcecode (using attached formatter settings)

Expected result:
the source does not change.

Actual result:
Undesired spaces are added and a period is wrapped to the next line.
Comment 1 Joerg Hohwiller CLA 2012-06-29 17:01:56 EDT
Created attachment 218111 [details]
The exported formatter settings
Comment 2 Joerg Hohwiller CLA 2012-06-29 17:02:47 EDT
Created attachment 218112 [details]
The original source code
Comment 3 Joerg Hohwiller CLA 2012-06-29 17:03:49 EDT
Created attachment 218113 [details]
The original source code after removing formatter off/on tags and formatting
Comment 4 Joerg Hohwiller CLA 2012-07-10 15:17:26 EDT
What applies for periods also applies for parentheses: 
* Formatter should NOT wrap directly after '(' 
* Formatter should NOT wrap directly before ')'
Comment 5 Tomasz Zarna CLA 2012-08-17 08:53:33 EDT
Once you add an argument to the tag (e.g. "{@value foo}") formatting works fine. This is how the tag is intended to be used.
Comment 6 Joerg Hohwiller CLA 2012-09-27 10:11:45 EDT
(In reply to comment #5)
> Once you add an argument to the tag (e.g. "{@value foo}") formatting works
> fine. This is how the tag is intended to be used.

Thanks for the response but you are missing the point. In this case you just insert a few more characters and therefore change the position of the period or parenthesis. I can sill reproduce the same bug with {@value foo}.
If I misunderstood your point, please be more precisely.

BTW: Also I disagree that e.g. {@link MyEntity} is bad practice and I should use {@link MyEntity my entity} instead because the extra text does not participate in refactorings.
Comment 7 Joerg Hohwiller CLA 2015-12-10 16:51:39 EST
I retested this with Eclipse Mars and it seems the bug has been fixed meanwhile.
Thanks for your great work!