Bug 157976

Summary: org.eclipse.uml2.uml.internal.operations.PropertyOperations.getOpposite(Property property) should also return navigable opposite ends owned by binary associations.
Product: [Modeling] MDT.UML2 Reporter: Alexander Nyßen <alexander>
Component: CoreAssignee: Kenn Hussey <Kenn.Hussey>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: awaltx
Version: 2.0.0   
Target Milestone: 2.0.1   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Alexander Nyßen CLA 2006-09-20 08:59:29 EDT
UML2 Superstructure 2.1 says: "An end property of an association that is owned by an end class or that is a navigable owned end of the association indicates that the association is navigable from the opposite ends, otherwise the association is not navigable from the opposite ends."

The current implementation of PropertyOperations.getOpposite does only return an opposite end if the given property is not owned by an association and therefore does not obey the specificatio in this point (it does indeed also contradict the javadoc-comment given in org.eclipse.uml2.uml.Property.getOpposite()).

I would therefore suppose to alter the implementation of PropertyOperations.getOppsosite() - to at least support that for navigable associations getOpposite can also be used if the property is owned by the association - as follows:

public static Property getOpposite(Property property) {

		if ((property.getOwningAssociation() != null && property.getOwningAssociation().isBinary() && property.isNavigable()) 
		  || property.getOwningAssociation() == null) {
			Property otherEnd = getOtherEnd(property);

			if (otherEnd != null && otherEnd.isNavigable()) {
				return otherEnd;
			}
		}

		return null;
	}
Comment 1 Kenn Hussey CLA 2006-09-20 23:22:57 EDT
The fix has been committed to CVS.
Comment 2 Kenn Hussey CLA 2006-09-21 10:04:03 EDT
Fixed in M200609210850.
Comment 3 Nick Boldt CLA 2008-01-28 16:36:14 EST
Move to verified as per bug 206558.