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

Bug 361514

Summary: [EMF Compare UML] Delete an element with a stereotype create a polluting difference
Product: [Modeling] EMFCompare Reporter: Arthur Daussy <arthur.daussy>
Component: CoreAssignee: EMF Compare <emf.compare-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: cedric.notot, laurent.goubet, vincent.lorenzo
Version: 1.3   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Models to reproduce the bug none

Description Arthur Daussy CLA 2011-10-20 05:46:30 EDT
Created attachment 205601 [details]
Models to reproduce the bug

When delete an element with a stereotype a UMLStereotypeApplicationRemoval diff is created. Which look like: 
Stereotype <Stereotype> Block has been unapplied on null.

How to reproduce:
 1. Create two model with one element stereotyped
 2. Delete this element in the "left" model
 3. Run comparison
 4. See result.
(See also models in attachment)

My guess is that the problem come from UMLStereotypeApplicationRemovalFactory.handles(DiffElement) which should test that the left based element is still available. I have tried to correct with:

	public boolean handles(DiffElement input) {
		if (input instanceof ModelElementChangeRightTarget) {
			final EObject rightElement = ((ModelElementChangeRightTarget)input).getRightElement();
			final Element rightBase = UMLUtil.getBaseElement(rightElement);
			if (rightBase != null) {
				final EObject leftBase = getEngine().getMatched(rightBase, MatchSide.LEFT);
				return leftBase != null;
			}
		}
		return false;
	}

But there is still some problems.

Regards,
Comment 1 Cedric Notot CLA 2011-10-28 12:59:27 EDT
This bug is linked with 361344. It is the same issue.

The fix and explanations are in this last one (Bug 361344).

Regards,
Cedric Notot
Comment 2 Laurent Goubet CLA 2011-11-03 05:01:59 EDT
Arthur, the build I outlined in bug 361344, comment 3 should also contains the fix for this. Could you verify the fix from your side?
Comment 3 Laurent Goubet CLA 2012-05-22 09:29:48 EDT
Closing now