Community
Participate
Working Groups
Created attachment 243884 [details] Project ForTaskWithArray.design If the expression of a ForTask is an array, returned by the service interpreter or the variable interpreter, this task iterates only on one element (the array itself) and not on each element of the array. Steps to reproduce: * Import the project "ForTaskWithArray.design" in a workspace * Launch a runtime * Import the project "ForTaskWithArray.sample" in the runtime-workspace * Open the diagram "new Diag" * Use the tool "Duplicates classes with array with service" on p1 package, nothing happens (KO) * Use the tool "Duplicates classes with array with variable" on p1 package, nothing happens (KO) * Use the tool "Duplicates classes with list with service" on p1 package, the 3 classes are duplicated as expected. The behavior for the first tools should be the same. In this use case, the difference between the 3 tools is that: * the first iterates on an array (returned by the service org.eclipse.sirius.sample.fortaskwitharray.Services.getEClassesAsArray(EPackage)) * the second iterates on an array (returned by a variable) * and the third iterates on a list (returned by the service org.eclipse.sirius.sample.fortaskwitharray.Services.getEClassesAsList(EPackage)) In ForTask, an array should be considered as list.
Created attachment 243885 [details] Project ForTaskWithArray.sample
Laurent, it seems you uploaded the same design project twice.
Created attachment 245426 [details] ForTaskWithArray.sample (and not the design project twice)
Created attachment 245427 [details] Sample
Thank you Laurent.
See https://git.eclipse.org/r/30583, which propose a draft which enables ForTask to iterate over arrays. But I think here the real issue is thaht we should call evaluateCollection instead of evaluate and then each IInterpreters should be able to handle arrays in its evaluateCollectionMethod.
The current behavior allows to iterate on the for taks over non EObject elements, in this case, the evaluation context is still the element on which the for expression has been evaluated. so we should correct handle the array case here but continue to call evaluate and not evalauteCollection which returns a collection of EObject and will remove the possibility to iterate over non EObject elements. However, handling the array case in the evaluateCollection method seems a good idea, it could be done in a separate commit/step on this bug.
See . https://git.eclipse.org/r/#/c/30583/ which corrects the ForTask . https://git.eclipse.org/r/#/c/31171/ which handled arrays in our interpreters evaluateCollection methods.
Corrected by commits . 389b9ddb366b77f1f05910d9dd33d50ecd43771d . 008bc96206e8afd5ad65cf0820cae88709c7be26 . 7b7c8e2882cf16424e1694f51965dc49acc0f8e4
Available in Sirius 2.0.0.