Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public DependencyManager deriveChildManager(DependencyCollectionContext context)
Collection<Exclusion> exclusions = managedDependency.getExclusions();
if (!exclusions.isEmpty()) {
if (managedExclusions == this.managedExclusions) {
managedExclusions = MMap.copy(this.managedExclusions);
managedExclusions = MMap.copyWithListValue(this.managedExclusions);
}
Collection<Holder<Collection<Exclusion>>> managed = managedExclusions.get(key);
if (managed == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
*/
package org.eclipse.aether.util.graph.manager;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

/**
* Warning: this is a special map-like construct that suits only and should be used only in this package!
Expand Down Expand Up @@ -47,6 +50,15 @@ public static <K, V> MMap<K, V> copy(MMap<K, V> orig) {
return new MMap<>(new HashMap<>(orig.delegate));
}

public static <K, V> MMap<K, Collection<V>> copyWithListValue(MMap<K, Collection<V>> orig) {
HashMap<K, Collection<V>> delegateLocal = orig.delegate;
HashMap<K, Collection<V>> newMap = new HashMap<>((int) Math.ceil(delegateLocal.size() / 0.75D));
for (Map.Entry<K, Collection<V>> entry : delegateLocal.entrySet()) {
newMap.put(entry.getKey(), entry.getValue() == null ? null : new ArrayList<>(entry.getValue()));
}
return new MMap<>(newMap);
}

protected final HashMap<K, V> delegate;

private MMap(HashMap<K, V> delegate) {
Expand Down