eclipse-ocl / org.eclipse.ocl

Eclipse Public License 2.0
0 stars 0 forks source link

[completeocl] Derived Properties are converted to Constraints #1518

Open eclipse-ocl-bot opened 1 month ago

eclipse-ocl-bot commented 1 month ago

| --- | --- | | Bugzilla Link | 467577 | | Status | NEW | | Importance | P3 normal | | Reported | May 19, 2015 08:57 EDT | | Modified | May 19, 2015 10:03 EDT | | See also | 465397 | | Reporter | Ed Willink |

Description

RC1: Rationalisation of SpecificationCS/ConstraintCS seems to have broken derived properties. They are converted to class constraints.

Now that warnings work again, RoyalAndLLoyal.ocl diagnoses non-unique invrainats. Why no test failure.

test_umlValidation_404882 involves a derived property. Again, why no test failure?

eclipse-ocl-bot commented 1 month ago

By Ed Willink on May 19, 2015 09:09

(In reply to Ed Willink from comment #0)

Now that warnings work again, RoyalAndLLoyal.ocl diagnoses non-unique invrainats. Why no test failure.

Load tests validate the CS resource. Need to validate the AS resource too.

eclipse-ocl-bot commented 1 month ago

By Ed Willink on May 19, 2015 09:39

(In reply to Ed Willink from comment #0)

RC1: Rationalisation of SpecificationCS/ConstraintCS seems to have broken derived properties. They are converted to class constraints.

Not entirely. They are indeed Class invariants.

context TransactionReportLine::amount : Real\ derive :\ self.transaction.amount

is equivalent to:

context TransactionReportLine\ inv: self.amount = self.transaction.amount

The validation error could be cured by defaulting the name to the property name.

(There is also a problem that the Outline fails to display the class-level invariant.)

eclipse-ocl-bot commented 1 month ago

By Ed Willink on May 19, 2015 10:03

(In reply to Ed Willink from comment #2)

Bug 465397#3 shows the way forward:

If:

context TransactionReportLine::amount : Real derive : self.transaction.amount

is equivalent to:

context TransactionReportLine::amount : Real\ inv: self.amount = self.transaction.amount

rather than

context TransactionReportLine inv: self.amount = self.transaction.amount

we have no duplicate names, and can associate a failure with the property.

But we need to add and use Property::ownedInvariants, which is undesirable post-RC1. SR1 perhaps.

Workaround: provide an explicit name to disambiguate derive:/inv:.