Bug 298243 - [formatter] Removing empty lines between import groups
Summary: [formatter] Removing empty lines between import groups
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.6   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.6 M5   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-12-19 03:16 EST by Konstantin Scheglov CLA
Modified: 2010-01-25 06:29 EST (History)
4 users (show)

See Also:


Attachments
Source with empty lines (216 bytes, text/java)
2009-12-19 07:57 EST, Konstantin Scheglov CLA
no flags Details
Formatting profile (28.28 KB, text/xml)
2009-12-19 07:59 EST, Konstantin Scheglov CLA
no flags Details
Proposed patch (2.54 KB, patch)
2009-12-21 05:17 EST, Frederic Fusier CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Konstantin Scheglov CLA 2009-12-19 03:16:14 EST
Build Identifier: I20091217-0819

This build of Eclipse 3.6 has problem that was not in 3.5.1.
Sometimes it remove empty lines between import groups.
This happens during formatting.

Reproducible: Always

Steps to Reproduce:
1. open compilation unit with empty lines between import groups;
2. do formatting, I use Ctrl+Shift+F
3. note that empty lines were removed.

What is interesting:
4. If you have save actions configured, including formatting, then after save (after formatting) these empty lines will be restored!
5. But if you don't do manual formatting and instead just save, then "formatting action on save" also will remove empty lines.

Weird!
Comment 1 Dani Megert CLA 2009-12-19 04:07:04 EST
>1. open compilation unit with empty lines between import groups;
>2. do formatting, I use Ctrl+Shift+F
>3. note that empty lines were removed.
Works fine for me using I20091215-1320. Can you please provide more detailed steps. Try to provide a test case that we can apply on a new workspace.

>5. But if you don't do manual formatting and instead just save, then
>"formatting action on save" also will remove empty lines.
Sounds like a different bug. This bug here is about formatting only.
Comment 2 Konstantin Scheglov CLA 2009-12-19 07:57:25 EST
Created attachment 154836 [details]
Source with empty lines

Open this file and format it.
Comment 3 Konstantin Scheglov CLA 2009-12-19 07:59:06 EST
Created attachment 154837 [details]
Formatting profile
Comment 4 Frederic Fusier CLA 2009-12-21 05:12:43 EST
This is a regression introduced while fixing bug 199265. The problem occurs only when a profile set no blank line to preserve (i.e. Blank lines to preserve = 0).
Comment 5 Frederic Fusier CLA 2009-12-21 05:17:11 EST
Created attachment 154866 [details]
Proposed patch

Test also if there are some lines to preserve between groups to know whether a call to getPreserveEmptyLines(int) method is necessary or not...
Comment 6 Frederic Fusier CLA 2009-12-21 09:36:51 EST
Released for 3.6M5 in HEAD stream.
Comment 7 Satyam Kandula CLA 2010-01-25 06:23:54 EST
Verified for 3.6M5 using Build id: I20100122-0800
Comment 8 Srikanth Sankaran CLA 2010-01-25 06:29:50 EST
Verified.