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

Bug 289660

Summary: [console] No duplicates violation saving an OCL Interpreter constraint
Product: [Modeling] OCL Reporter: Ed Willink <ed>
Component: CoreAssignee: OCL Inbox <mdt-ocl-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: felix.dorner, nicolas.f.rouquette
Version: 1.3.0Keywords: plan
Target Milestone: ---Flags: ed: indigo-
Hardware: PC   
OS: Windows XP   
Whiteboard: Usability
Bug Depends on:    
Bug Blocks: 318358    

Description Ed Willink CLA 2009-09-16 17:13:31 EDT
From news://news.eclipse.org:119/h8rf01$lli$1@build.eclipse.org

I tried this on the EXTLibrary example and get the same error for simple OCL expressions.

1.  I installed eclipse-modeling-galileo-incubation-win32.zip
2.  I start and switch to the Plug-in Development Perspective
3.  I switch to the Plugins tab and import as source org.eclipse.emf.ocl.examples
4.  I then Import "Existing Projects into Workspace" for each of the zip files: interpreter.zip, library.zip, libraryEdit.zip, and libraryEditor.zip and get four projects that build properly.
5.  I run the Editor project, which launches an Eclipse Runtime.
6.  I create a new EMF Project, and then create an EXTLibrary Model.
7.  In the Editor, I add a Library Child and give it a name.
8.  I right-click on the Library Node, and start the OCL Interpreter.
9.  In the bottom pane (the SourceViewer), I enter: name and then hit enter.  In the TextViewer pane, I see the Results with the correct information for the name displayed.
10. I want to save this OCL Expression to an xmi file and click on the Save button.  I select a directory and create a new file name.  When I hit OK, I get the ERROR dialog:
OCLConsole Saving Error: The 'no duplicates' constraint is violated

---

It appears that the addition of 

		// persist the expression
		persist(env, result);
		
		// dispose the remainder of the constraint
		ObjectUtil.dispose(constraint);
		
by Bug 219051 is the culprit. Possibly just needs the duplicate save in OCLResource.save to be removed; but why are there also two self variables?

Why did no JUNit test that catch this?
Comment 1 Felix Dorner CLA 2013-01-31 09:53:02 EST
I can still reproduce this in org.eclipse.ocl.examples.interpreter 3.0.2.

If I remove line 135, res.setOCLExpression(parsed),

as Ed suggests in the newsgroup, the error disappears.
Comment 2 Ed Willink CLA 2013-02-01 17:16:40 EST
I am afraid that:
the relevant code is only examples
it is being superseded by the Xtext OCL Console
the tentative fixes don't look very convincing
some of the tentative fixes may affect the core code

(The new code uses ExpressionInOCL as the query quantum, so there is no problem with orphan self variables.)

So: WONTFIX
Comment 3 Felix Dorner CLA 2013-02-04 03:45:49 EST
Ok thanks.
Comment 4 Ed Willink CLA 2013-06-02 16:15:55 EDT
*** Bug 409668 has been marked as a duplicate of this bug. ***
Comment 5 Ed Willink CLA 2014-05-27 09:46:01 EDT
CLOSED after more than a year in RESOLVED state.
Comment 6 Ed Willink CLA 2014-05-27 09:53:21 EDT
and CLOSE