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

Bug 126255

Summary: [quick assist] 'Convert to if-else' removes empty lines
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3    
Version: 3.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug

Description Markus Keller CLA 2006-02-02 15:05:50 EST
I20060131-1200

The 'Convert to if-else' quick assist removes empty lines where it shouldn't.

In:
    void m() {
        if (true) { //convert to if-else
            return;
        }
        
        System.out.println(1);
        
        System.out.println(2);
        
        System.out.println(3);
    }

Out:
    void m() {
        if (true) {
        } else {
            System.out.println(1);
            System.out.println(2);
            System.out.println(3);
        }
    }

Expected:
    void m() {
        if (true) { //convert to if-else
            return;
        } else {
            
            System.out.println(1);
            
            System.out.println(2);
            
            System.out.println(3);
        }
    }

The empty line before System.out.println(1); can be skipped, but the others should be preserved. Also, the comment should not be deleted.
Comment 1 Eclipse Genie CLA 2019-11-03 00:42:19 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.