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

Bug 463225

Summary: IIntepreter instances used for completion are shared and their configuration can be changed by other parts of the code
Product: [Modeling] Sirius Reporter: Cedric Brun <cedric.brun>
Component: CoreAssignee: Cedric Brun <cedric.brun>
Status: CLOSED FIXED QA Contact: Belqassim Djafer <belqassim.djafer>
Severity: normal    
Priority: P3 CC: laurent.redor, maxime.porhel
Version: unspecifiedKeywords: triaged
Target Milestone: 3.0.0M7   
Hardware: PC   
OS: Linux   
See Also: https://git.eclipse.org/r/44706
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=4b68b79600eb9c913977dbd72af2f7f30bc588a1
Whiteboard:

Description Cedric Brun CLA 2015-03-26 12:47:19 EDT
Validation and completion services (used in the .odesign editor and in the interpreter view) are relying on org.eclipse.sirius.common.tools.api.interpreter.CompoundInterpreter.INSTANCE, always interrogating this instance to retrieve the "right interpreter for the given expression". 

This singleton will use only one IInterpreter instance for each language, though expression contexts (activated metamodels, imported classes, projects in the scope) might be different in between calls. Leading to reported errors or worse.

Here is the change I propose :
- to implement such services, instead of reusing the same IInterpreter instances create a *new one*, dispose it when the service is done.
- provide an utility method which does all the setup of an IInterpreter instance from a IInterpreterContext.
- use this setup method in the callees.

In doing so each interpreter (and more especially AQLSiriusInterpreter) will no more have to do their own setup based on the given IInterpreterContext, Callees code have to do that otherwise we can't know if this change of configuration will have effects on an instance which is used in a completely different context.
Comment 1 Eclipse Genie CLA 2015-03-26 13:16:22 EDT
New Gerrit change created: https://git.eclipse.org/r/44706
Comment 3 Cedric Brun CLA 2015-04-17 12:21:21 EDT
done for M7
(This is a technical issue)
Comment 4 Belqassim Djafer CLA 2015-05-26 04:21:46 EDT
Validated as technical change
Comment 5 Maxime Porhel CLA 2015-05-26 10:53:01 EDT
Validated on Sirius 3.0.0 RC1
Comment 6 Pierre-Charles David CLA 2015-06-24 11:15:42 EDT
Available in Sirius 3.0.0. See https://wiki.eclipse.org/Sirius/3.0.0.