Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 348338 - [formatter] Bad line breaking in Eclipse javadoc comments
Summary: [formatter] Bad line breaking in Eclipse javadoc comments
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows 7
: P3 normal with 1 vote (vote)
Target Milestone: 4.6 M1   Edit
Assignee: Mateusz Matela CLA
QA Contact: Ayushman Jain CLA
URL:
Whiteboard:
Keywords:
: 480359 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-06-05 14:17 EDT by Ted Hopp CLA
Modified: 2015-12-25 09:34 EST (History)
8 users (show)

See Also:
manoj.palat: review+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ted Hopp CLA 2011-06-05 14:17:11 EDT
Build Identifier: 20110218-0911

If a javadoc line ends with the closing brace of a tag in the last line before the current line wrap setting and is followed immediately by a period, formatting the code will move the period to the start of the next javadoc line. This puts white space between the text and the period in the generated output, so a browser rendering the Javadoc in HTML, for instance, will also think it's okay to break there. This doesn't seem to happen unless the period follows a Javadoc tag. (For instance, if the line ended with a closing parenthesis and a period in column 81, it would correctly break before the last word.)

Reproducible: Always

Steps to Reproduce:
1. Write some Javadoc like this:

/**
 * - - - stuff - - - {@code mTasksBelow}.
 */

where the period is at the wrap column + 1.

2. Format the code (using CTRL-SHIFT-F or Source > Format.
Comment 1 Ayushman Jain CLA 2011-06-06 03:10:08 EDT
Reproduced with 3.7RC4
Comment 2 Trevor Robinson CLA 2014-04-30 13:19:25 EDT
This still occurs as of Kepler SR1 (20130919-0819). It applies not only to periods, but also commas, semicolons, etc.
Comment 3 David Pauli CLA 2015-03-27 06:05:13 EDT
Still exists in Luna :(
Where is the problem to fix this with making an \n to an visible <br/> guys?
Comment 4 Mateusz Matela CLA 2015-05-05 18:18:08 EDT
Manoj, I can provide a patch for this - would you push it into one of the release candidates?
Bug 383942 and bug 460318 can be marked as duplicate.
Comment 5 Jay Arthanareeswaran CLA 2015-06-30 02:11:08 EDT
(In reply to Mateusz Matela from comment #4)
> Manoj, I can provide a patch for this - would you push it into one of the
> release candidates?
> Bug 383942 and bug 460318 can be marked as duplicate.

Is this still a concern and the offer still available? :)
Comment 6 Mateusz Matela CLA 2015-07-08 18:13:40 EDT
Sure :)
I've pushed my change to gerrit: https://git.eclipse.org/r/#/c/51624/
I use gerrit for the first time, I don't know why it didn't start a build and add a notification here.

In general I have several fixes ready for the formatter, but I was going to wait for one patch to be accepted before pushing another to avoid merge conflicts (which are almost certain in test classes). Currently bug 471090 awaits review.
Let me know if conflicts would not be a problem and you'd prefer more patches simultaneously.
Comment 8 Mateusz Matela CLA 2015-07-24 18:16:20 EDT
(In reply to Eclipse Genie from comment #7)
> Gerrit change https://git.eclipse.org/r/51624 was merged to [master].
> Commit:
> http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/
> ?id=260ff63e87f242ab982cdcea6ba42f866e16f101
It's fixed then.
Comment 9 Jay Arthanareeswaran CLA 2015-08-05 01:57:52 EDT
Verified for 4.6 M1 with build I20150804-2000.
Comment 10 Mateusz Matela CLA 2015-12-25 08:46:12 EST
*** Bug 480359 has been marked as a duplicate of this bug. ***