eclipse-ocl / org.eclipse.ocl

Eclipse Public License 2.0
0 stars 0 forks source link

[pivot-uml] Inconsistent handling of UML::OccurrenceSpecification::covered #1756

Closed eclipse-ocl-bot closed 2 hours ago

eclipse-ocl-bot commented 2 hours ago

| --- | --- | | Bugzilla Link | 507406 | | Status | RESOLVED FIXED | | Importance | P3 normal | | Reported | Nov 11, 2016 09:24 EDT | | Modified | Nov 11, 2016 14:23 EDT | | Reporter | Ed Willink |

Description

https://www.eclipse.org/forums/index.php/mv/msg/1082369/1747267/#msg_1747267 provides a repro in which console hovertext for UML::OccurrenceSpecification::covered reports a non-collection while execution seems to have a Swquence.

eclipse-ocl-bot commented 2 hours ago

By Ed Willink on Nov 11, 2016 10:36

Problem is that OccurrenceSpecification::covered [0..1] redefines InteractionFragment::::covered [0..*], so redefinition is not always a verbose exposition of a virtual overload. The OCL analysis 'knows' that the return is a collection, but UML returns a

It seems really smelly that an oclAsType() can change the return from collection to non-collection.


Specifically an ExplicitNavigationProperty is performed for a $uml$::OccurrenceSpecification::covered propertyId, but the eGet uses InteractionFragment::covered.

eClass.getEStructuralFeature(propertyId.getName())

is failing to follow the redefinition.

eclipse-ocl-bot commented 2 hours ago

By Ed Willink on Nov 11, 2016 11:42

(In reply to Ed Willink from comment #1)

It seems really smelly that an oclAsType() can change the return from collection to non-collection.

Which is why the actual UML2/EMF implementation of OccurrenceSpecification::covered returns a List rather than an Object, thereby complying with Java conventions and breaking modeling conventions.

When OCL evaluates a UML redefined property it must adjust the unredefined Java access to give the redefined behaviour. This can be accommodated by introducing a RedefinedNavigationProperty implementation for use instead of the ExplicitNavigationProperty. The implementation decision is satisfactorily in UML-specific pivot-land.

UMLEcoreTechnology.createExplicitNavigationPropertyImplementation can handle the irregularity.

eclipse-ocl-bot commented 2 hours ago

By Ed Willink on Nov 11, 2016 14:23

Pushed to

master for M4\ maintenance/R6_2 for 6.2.2RC1\ maintenance/R6_1 for 6.1.2RC1