eclipse-ocl / org.eclipse.ocl

Eclipse Public License 2.0
0 stars 0 forks source link

Add allInstances() static operation to Signals #1716

Closed eclipse-ocl-bot closed 6 days ago

eclipse-ocl-bot commented 6 days ago

| --- | --- | | Bugzilla Link | 496210 | | Status | RESOLVED FIXED | | Importance | P3 normal | | Reported | Jun 15, 2016 14:33 EDT | | Modified | Aug 20, 2016 11:29 EDT | | Version | 6.0.0 | | Reporter | Denis Nikiforov |

Description

Here is a test project:\ https://github.com/AresEkb/allInstances_test

It contains a simple UML model with classes and signals.

I'm trying to create invariants of the form for them:\ Class1.allInstances()->notEmpty()\ Signal1.allInstances()->notEmpty()

The invariant is created for the Class without errors.

But for the Signal I get the following exception:

org.eclipse.ocl.pivot.utilities.SemanticException: The 'test::Signal1' constraint is invalid: 'Signal1.allInstances()->notEmpty()'\ 1: Unresolved Static Operation 'test::Signal1::allInstances()'\ at org.eclipse.ocl.pivot.utilities.PivotUtil.checkResourceErrors(PivotUtil.java:144)\ at org.eclipse.ocl.pivot.internal.context.AbstractParserContext.parse(AbstractParserContext.java:154)\ at org.eclipse.ocl.pivot.internal.helper.OCLHelperImpl.createInvariant(OCLHelperImpl.java:113)\ at org.eclipse.ocl.pivot.utilities.OCL.createInvariant(OCL.java:261)

It seems, that allInstances() is not defined for signals. Could you define it for them? Thanks!

eclipse-ocl-bot commented 6 days ago

By Denis Nikiforov on Jun 16, 2016 01:30

Also Singals has the allInstances() operation in Rational Software Architect 9.5. I guess that RSA uses older version of Classic OCL.

eclipse-ocl-bot commented 6 days ago

By Ed Willink on Jun 16, 2016 06:52

It seems that some of the UML support got 'lost' when UML was made optional via the org.eclipse.ocl.pivot.uml plugin. Forked off to Bug 496251.

The specific problem with Signal.allInstances is caused by a missing implicit inheritance from OclElement. UML2ASReferenceSwitch assumed that Signal inherits Class rather than Classifier. Promoting DataType functionality to Classifier fixes this.

eclipse-ocl-bot commented 6 days ago

By Ed Willink on Jun 16, 2016 06:55

Trivial fix available on branch ewillink/master at

commit e1f04974470ba41286d97e49fed525d1fcd4dd23

[496210] Provide OclElement superclass to all UML classifiers


OCL 6.1 for Luna/Mars/Neon is awaiting release next week.

OCL 6.2 for Neon (built using Xtext 2.10) is awaiting release shortly thereafter

ewillink/master is for OCL 6.3.

This fix will eventually be in OCL 6.1.1 and 6.2.1.

eclipse-ocl-bot commented 6 days ago

By Denis Nikiforov on Jun 17, 2016 06:42

Thanks!

I'm trying to build OCL from sources. I'm not very experienced in it. I've imported sources into Eclipse by Oomph. By default the maintenance/R6_0 brach is opened and it is build without errors. But when I switch to ewillink/master I get ~5000 build errors. It seems that most of them are caused by "The import org.eclipse.xtext cannot be resolved".

I've installed Xtext Complete SDK 2.10.0 from\ http://download.eclipse.org/modeling/tmf/xtext/updates/composite/releases/

But it doesn't help. Maybe I need to configure something?

eclipse-ocl-bot commented 6 days ago

By Ed Willink on Jun 17, 2016 07:38

(In reply to Denis Nikiforov from comment #4)

I've installed Xtext Complete SDK 2.10.0 from

It should work. Sometimes you need a restart/clean/rebuild or two.

eclipse-ocl-bot commented 6 days ago

By Denis Nikiforov on Jun 19, 2016 00:54

I tried several options:

1) I made a simillar modifications (related to allInstances) in maintenance/R6_0. I have no any build errors in the workspace. But when I try to export the features I get a lot of the following errors in the log: "The import org.eclipse.jdt cannot be resolved"

2) I tried to checkout ewillink/master but as result I get a lot of "The import org.eclipse.xtext cannot be resolved" errors.

3) I tried to clone git repository without Oomph. And now I get much less errors! It seems that Oomph restricts eclipse workspace to xtext 2.9. It's not enough to install xtext 2.10. I can see only xtext 2.9 in Windows -> Show view -> Plug-ins when I import OCL projects into the workspace by means of Oomph. But I still can't build OCL because now I get another errors: "Bundle 'org.eclipse.papyrus.sysml' cannot be resolved", "Invalid @since 1.1 tag on ABSTRACT; expecting @since 1.3 AbstractInheritance.java", ...

As I see it's not enough 1) to do File -> Import -> Oomph -> Projects into Workspace 2) checkout ewillink/master and 3) install xtext sdk 2.10. Because Oomph configures Eclipse to use xtext 2.9. Some additional setup is needed. Maybe I can download some nightly builds? All this stuff looks too complex for me (

eclipse-ocl-bot commented 6 days ago

By Ed Willink on Jun 19, 2016 05:05

(In reply to Denis Nikiforov from comment #6)

1) I made a simillar modifications (related to allInstances) in maintenance/R6_0. I have no any build errors in the workspace. But when I try to export the features I get a lot of the following errors in the log: "The import org.eclipse.jdt cannot be resolved"

6.0 retained Java 5/6/7 and consequently had to have a bootleg variant of org.eclipse.jdt.annotation (org.eclipse.ocl.jdt.annotation7) after JDT made an incompatible change for Java 8. It is quite hard to get these to work correctly with a Java 8 compiler. Hence with relief 6.1 moved to Java 8 only after parts of the platform became Java 8 only. \

2) I tried to checkout ewillink/master but as result I get a lot of "The import org.eclipse.xtext cannot be resolved" errors.

Restart/clean/build a couple of times. Eclipse incremental build fails for mega-project changes.\

3) I tried to clone git repository without Oomph. And now I get much less errors! It seems that Oomph restricts eclipse workspace to xtext 2.9. It's not enough to install xtext 2.10. I can see only xtext 2.9 in Windows -> Show view -> Plug-ins when I import OCL projects into the workspace by means of Oomph. But I still can't build OCL because now I get another errors: "Bundle 'org.eclipse.papyrus.sysml' cannot be resolved", "Invalid @since 1.1 tag on ABSTRACT; expecting @since 1.3 AbstractInheritance.java", ...

Close the error-affected test projects (or install Papyrus bits).

As I see it's not enough 1) to do File -> Import -> Oomph -> Projects into Workspace 2) checkout ewillink/master and 3) install xtext sdk 2.10. Because Oomph configures Eclipse to use xtext 2.9. Some additional setup is needed. Maybe I can download some nightly builds? All this stuff looks too complex for me (

I'm afraid that I do not yet use OOMPH. I plan to start a week after Neon is released and any issues have been reported.

eclipse-ocl-bot commented 6 days ago

By Ed Willink on Jun 19, 2016 05:24

(In reply to Ed Willink from comment #7)

As I see it's not enough 1) to do File -> Import -> Oomph -> Projects into Workspace 2) checkout ewillink/master and 3) install xtext sdk 2.10. Because Oomph configures Eclipse to use xtext 2.9. Some additional setup is needed. Maybe I can download some nightly builds? All this stuff looks too complex for me (

I'm afraid that I do not yet use OOMPH. I plan to start a week after Neon is released and any issues have been reported.

Reading the ocl.oomph setup file, I see no enforcement of Xtext 2.10. More likely you have selected Mars repositories and so http://download.eclipse.org/releases/mars which offers Xtext 2.9.1 rather than http://download.eclipse.org/releases/neon which offers Xtext 2.10.

You are working at a very awkward time; the final few weeks in which final Neon testing and mirroring takes place; Neon is built but not released and so only available by backdoors. For instance, you can find the download for OCL 6.1.0RC3 as http://www.eclipse.org/modeling/download.php?file=/modeling/mdt/ocl/downloads/drops/6.1.0/S201605300614/mdt-ocl-Update-6.1.0RC3.zip by browsing http://www.eclipse.org/modeling/download.php. But you can only download the (identical) mdt-ocl-Update-6.1.0.zip by 'guessing' the URL for an R201605300614. Neon P2 update repros should be similarly hidden.

eclipse-ocl-bot commented 6 days ago

By Denis Nikiforov on Jun 20, 2016 01:58

Thanks for your help! I've installed nightly build and tested allInstances() operation, it works in my project now. Althought I couldn't build OCL from sources, I learned something new about Oomph and Eclipse git repositories. I think after Neon release some thnings will be easier for me.

eclipse-ocl-bot commented 6 days ago

By Ed Willink on Aug 20, 2016 11:29

Pushed to master, maintenance/R6_2, maintenance/R6_1 for 6.3.0M1, 6.2.1, 6.1.1.