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

Bug 547699

Summary: Remove Sets call in ContainerMappingHelper to avoid a guava dependency
Product: [Modeling] Sirius Reporter: Pierre-Charles David <pierre-charles.david>
Component: CoreAssignee: Project inbox <sirius.core-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: laurent.fasani, pierre-charles.david, sirius.core-inbox, steve.monnier
Version: 6.1.2   
Target Milestone: 6.2.2   
Hardware: PC   
OS: Windows 10   
See Also: https://git.eclipse.org/r/142870
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=3a12bac006c3645a13f4313af2ce2d63c7034e53
https://git.eclipse.org/r/143932
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=9aa7ea2183c8752b93d0daad0e0311829903154c
Whiteboard:
Bug Depends on: 546769    
Bug Blocks:    

Description Pierre-Charles David CLA 2019-05-27 11:25:50 EDT
+++ This bug was initially created as a clone of Bug #546769 +++

The use of Sets in getAllNodeMappings and getAllContainerMappings methods introduce a dependency to guava that is not needed in some Sirius-based application.
Comment 1 Eclipse Genie CLA 2019-05-27 11:30:09 EDT
New Gerrit change created: https://git.eclipse.org/r/142870
Comment 3 Pierre-Charles David CLA 2019-05-28 09:40:44 EDT
Fixed by 3a12bac006c3645a13f4313af2ce2d63c7034e53.
Comment 4 Laurent Fasani CLA 2019-06-13 04:26:12 EDT
Les mapping ne sont plus rendus dans le même ordre

JavaDoc de java.util.AbstractCollection.addAll(Collection<? extends E>)
>    The behavior of this operation is undefined ifthe specified collection is modified while the operation is in progress. (This implies that the behavior of this call is undefined if thespecified collection is this collection, and this collection isnonempty.)

Au contraire, Sets.union de guava garde l'ordre des Set si l'implem de Set le permet

On devrait plutôt utiliser les Stream java
JavaDoc de Stream.concat

>    Creates a lazily concatenated stream whose elements are all theelements of the first stream followed by all the elements of thesecond stream. The resulting stream is ordered if bothof the input streams are ordered

Cela donnerait ca pour fixer:

Stream.concat(new LinkedHashSet<NodeMapping>(self.getSubNodeMappings()).stream(),new LinkedHashSet<NodeMapping>(self.getReusedNodeMappings()).stream())
Comment 5 Eclipse Genie CLA 2019-06-13 04:34:46 EDT
New Gerrit change created: https://git.eclipse.org/r/143932
Comment 7 Pierre-Charles David CLA 2019-07-15 03:12:30 EDT
Available in Sirius 6.2.2, see https://wiki.eclipse.org/Sirius/6.2.2