eclipse-sisu / sisu-project

Sisu Inject
https://www.eclipse.org/sisu
Eclipse Public License 2.0
17 stars 15 forks source link

EntryMapAdapter should preserve order of underlying Iterable #59

Closed kwin closed 1 year ago

kwin commented 1 year ago

As the EntryMapAdapter extends from AbstractMap its iteration order is non-predictable. In order to keep the order from the underlying Iterable it should rather extend from LinkedHashMap.

mcculls commented 1 year ago

The iteration order is controlled by the entry set iterator provided to AbstractMap and that order is derived from various things such as relative component priority and registration order. It's not necessary to extend a concrete implementation such as LinkedHashMap.

Can you provide an example or test case demonstrating the issue you're seeing?

kwin commented 1 year ago

Sorry, my bad. In https://github.com/apache/maven-scm/blob/b04525fa0716e6de7a65bf9970284efa0e49b177/maven-scm-api/src/main/java/org/apache/maven/scm/manager/AbstractScmManager.java#L82 the subsequent entries incorrectly overwrite former entries with the same key. EntryMapAdapter is behaving correctly here.