Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 197325 - [formatter] does not remove blank lines at the beginning and end of blocks
Summary: [formatter] does not remove blank lines at the beginning and end of blocks
Status: CLOSED DUPLICATE of bug 212867
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P5 normal with 3 votes (vote)
Target Milestone: ---   Edit
Assignee: Mateusz Matela CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-07-20 14:03 EDT by Daniel Aborg CLA
Modified: 2017-04-09 16:04 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Aborg CLA 2007-07-20 14:03:42 EDT
Build ID: I20070621-1340

Steps To Reproduce:

public void method() {

    for (int i = 0; i < 10; i++) {

        System.out.println(i);

        {

            System.out.println(i);

            System.out.println(i);

        }

    }

}

After formatting, should read:

public void method() {
    for (int i = 0; i < 10; i++) {
        System.out.println(i);
        {
            System.out.println(i);

            System.out.println(i);
        }
    }
}


More information:

Probably requires extra options in the blank lines section.

One possible implementation would be two additional checkboxes on the Blank Lines tab:

1) "Remove blank lines at the beginning of blocks."
2) "Remove blank lines at the end of blocks."

Could also be implemented with two "number of lines to preserve" style options instead.

Either way, these setting must override "Number of empty lines to preserve" to be useful.

As a side suggestion, maybe "Blank lines withing class declarations / At beginning of method body" should override "Number of empty lines to preserve"?
Comment 1 Frederic Fusier CLA 2008-08-18 08:07:51 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 2 Mateusz Matela CLA 2017-04-09 16:04:08 EDT

*** This bug has been marked as a duplicate of bug 212867 ***