Bug 411801

Summary: [quick fix] Unable to perform multi-fix 'Remove '@Override' annotation'
Product: [Eclipse Project] JDT Reporter: Blessed Geek <blessedgeek>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: ASSIGNED --- QA Contact:
Severity: enhancement    
Priority: P3 CC: daniel_megert, markus.kell.r, noopur_gupta
Version: 4.2.2   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Blessed Geek CLA 2013-06-27 12:46:11 EDT
I am using Juno 4.2.2. I am certain this problem had existed since antiquity (actually ever since multiple quick fix became a feature).


I have four errors within the same Java source file. The reason for the error was that the code was developed on JDK 1.6 which allows @override annotation on interface implementation. The source file was then merged with a JDK 1.5 workspace.

Consequently, these errors were listed on the [Problems] pane.

The method onSelection(SelectionEvent<Genx<TypA>>) of type new SelectionHandler<Genx<TypA>>(){} must override a superclass method

The method onSelection(SelectionEvent<Genx<TypB>>) of type new SelectionHandler<Genx<TypB>>(){} must override a superclass method

The method onSelection(SelectionEvent<Genx<TypC>>) of type new SelectionHandler<Genx<TypC>>(){} must override a superclass method

The method onSelection(SelectionEvent<Genx<TypD>>) of type new SelectionHandler<Genx<TypD>>(){} must override a superclass method


Steps:

1. Right-click on each problem and perform quick fix - the quick fix would be completed unimpeded to completion.

2. Select all four and right-click to quick fix - a Quick Fix dialog pops up to inform me that ...

The selected problems do not have a common applicable quick fix.
Only select similar problems or try Source > Clean Up to fix multiple problems at once.


Explanation/Discussion:
These are obviously similar problems. Not just similar but stupendously similar.
The algorithm to detect similar quick-fixable problems is insufficient or defective.

I normally do not wish to perform a Clean up to fix the whole project or workspace, for reasons beyond the scope of this bug. I wish to have more control to choose what I wish to fix.
Comment 1 Noopur Gupta CLA 2013-06-28 06:14:59 EDT
Multi quick fix does not work with following example also when when used with JDK 1.5:
------------------------------------
public interface I {
	void foo();
}

abstract class C implements I {
}

class Test {
	C o1 = new C() {
		@Override
		public void foo() {
		}
	};

	C o2 = new C() {
		@Override
		public void foo() {
		}
	};
}
------------------------------------
Multi-fix support is implemented on a case by case basis and is not implemented for the quick fix: Remove '@Override' annotation.

Dani/Markus, is this quick fix a candidate for multi-fix?