Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 441573 - [Markers] Duplicate quick-fix when applying a WorkbenchMarkerResolution
Summary: [Markers] Duplicate quick-fix when applying a WorkbenchMarkerResolution
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.3.2   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 4.6 M1   Edit
Assignee: Jan-Ove Weichel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 391711 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-08-12 06:31 EDT by Jens Rabe CLA
Modified: 2019-07-11 03:56 EDT (History)
5 users (show)

See Also:


Attachments
Plugin-Project for testing (6.00 KB, application/x-zip-compressed)
2015-04-24 16:48 EDT, Jan-Ove Weichel CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jens Rabe CLA 2014-08-12 06:31:29 EDT
When implementing a quick fix via WorkbenchMarkerResolution, using it from the problems view causes the quick-fix to appear twice. I tracked it down to the QuickFixHandler, where containsAllButFirst seems to have a bug. To my understanding, containsAllButFirst should return true when the "extend" contains all elements of "members", but not the first one. However, if members CONTAINS the first one, it still returns true.
Comment 1 Jens Rabe CLA 2014-08-12 06:35:39 EDT
I have to correct myself, the duplicate appearance of the marker happens in the "if" block, where the following happens:

markers.add(firstSelectedMarker);		markers.addAll(Arrays.asList(other));

Those statements should be reversed and the markers.add(firstSelectedMarker); should only be called if markers does not already contain the firstSelectedMarker.
Comment 2 Eclipse Genie CLA 2015-04-24 16:04:40 EDT
New Gerrit change created: https://git.eclipse.org/r/46459
Comment 3 Jan-Ove Weichel CLA 2015-04-24 16:48:17 EDT
Created attachment 252752 [details]
Plugin-Project for testing

The plugin contains a subclass of WorkbenchMarkerResolution which accepts everything as otherMarker. I used the Plugin to test the Bugfix

To use the plugin for testing:
1. Import Plugin into eclipse and start it
2. Create a new Java-Project in test-environment and create a Java-File which contains multiple Errors (or use the test class)
3. Click in the Problem-View on the Error an select Quick-Fix
4. Select "Test Resolution"

Test class:

package testProject;
import java.util.Collection;

public class testClass {

	
	public void name() {
		Collection demo = new ArrayList();
		Collection testBla = new ArrayList();
	}

}
Comment 5 Lars Vogel CLA 2015-07-24 05:34:07 EDT
Thanks Jan-Ove for the contribution.
Comment 6 Andrey Loskutov CLA 2019-07-11 03:56:17 EDT
*** Bug 391711 has been marked as a duplicate of this bug. ***