| Summary: | unSetVariable is not implemented for VariableInterpreter | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Modeling] Sirius | Reporter: | Laurent Redor <laurent.redor> | ||||
| Component: | Core | Assignee: | Maxime Porhel <maxime.porhel> | ||||
| Status: | CLOSED FIXED | QA Contact: | |||||
| Severity: | major | ||||||
| Priority: | P3 | CC: | maxime.porhel, pierre-charles.david | ||||
| Version: | 0.9 | Keywords: | triaged | ||||
| Target Milestone: | 2.0.0 | ||||||
| Hardware: | All | ||||||
| OS: | All | ||||||
| Whiteboard: | |||||||
| Bug Depends on: | |||||||
| Bug Blocks: | 435203 | ||||||
| Attachments: |
|
||||||
Note that proper variable management should probably be handled directly in AbstractInterpreter, as ServiceInterpreter extends AbstractInterpreter and also needs a correct view of the current variables value. First version of fix: https://git.eclipse.org/r/27830 This solution uses the VariableManager (as query legacy) to manage the push/peak/pop mechanism for the variables. Bug 435203 duplicates this bug, but will be used for the (partial) report of the correction on 1.0.x. On master we could think about using the VariableManager in AcceleoMTLInterpretr too, to have the same vaiabral managmeent logic in all our interpreters. See https://git.eclipse.org/r/#/c/27830/4 which adds the variable stack support to var: and service: See https://git.eclipse.org/r/#/c/30408/ for a DRAFT which makes the AcceleoMTLInterpreter use a VariableManager, but Acceleo is expecting a ListMultiMap, so we have to create one on each evaluation. We need to check the impact on performances. See commit 5e601dc2130d92b15ca8d2dc0959dfb5daf9fde5 for the unSetVariable implementation for var: and service: The second proposed commit (https://git.eclipse.org/r/#/c/30408/) has been abandonned as it does not correct a bug and could introduce some performance regressions. Available in Sirius 2.0.0. |
Created attachment 243890 [details] Project use case The behavior of org.eclipse.sirius.common.tools.api.interpreter.IInterpreter.unSetVariable(String) is not well documented. As consequence, the behavior is not the same for acceleo3 query and for the new variable interpreter. The name of the unSetVariable method is not well named. Indeed, the expected behavior when a variable is unsetted is to retreive its previous value (the one before the last setVariable() call). Steps to reproduce: * Import the project "VarInterperterUnsetProblem" in your workspace * Open the diagram "new Diag" * Use the tool "Reveal packages and classes using var" on diagram, only the first package and its classes appear (KO) * Delete this package from the diagram (and not from the model) * Use the tool "Reveal packages and classes using acceleo3" on diagram, all the packages and their classes appear as expected. In this use case, the difference between the 2 tools is that: * the first uses "var:containerView" as container view expression of CreateView task * the second uses "[containerView/]" as container view expression of CreateView task With the variable interpreter, during the creation of the first view, a refresh is launched and the containerView is override by another value. During the second iteration, the containerView variable has not the expected value because the unSetVariable did nothing.