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

Bug 302600

Summary: [quick fix] Dead code quick fix leaves extra braces
Product: [Eclipse Project] JDT Reporter: John Arthorne <john.arthorne>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert
Version: 3.5   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description John Arthorne CLA 2010-02-11 11:33:12 EST
I20100209-2300

I have code like this:

Object o = getObject();
if (o != null) {
	if (o == null) {
		System.out.println("hello");
	} else {
		System.out.println("bye");
	}
}

It correctly reports dead code in the inner if statement. However, when I invoke the quick fix I end up with:

Object o = getObject();
if (o != null) {
	{
		System.out.println("bye");
	}
}

I think it should remove the extra set of braces here. Other quickfixes such as "remove unnecessary else clause" don't leave the braces behind.
Comment 1 Dani Megert CLA 2010-04-14 03:07:15 EDT

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