|
51 | 51 | * or applied in same POM) are always applied. This implementation makes sure, that version and scope are not applied |
52 | 52 | * onto same node that actually provided the rules, to no override work that ModelBuilder did. It achieves this goal |
53 | 53 | * by tracking "depth" for each collected rule and ignoring rules coming from same depth as processed dependency node is. |
| 54 | + * <p> |
| 55 | + * Note for future: the field {@code managedLocalPaths} is <em>intentionally left out of hash/equals</em>, with |
| 56 | + * reason explained above. |
54 | 57 | * |
55 | 58 | * @since 2.0.0 |
56 | 59 | */ |
@@ -113,15 +116,8 @@ protected AbstractDependencyManager( |
113 | 116 | // nullable: if using scope manager, but there is no system scope defined |
114 | 117 | this.systemDependencyScope = systemDependencyScope; |
115 | 118 |
|
116 | | - this.hashCode = Objects.hash( |
117 | | - depth, |
118 | | - deriveUntil, |
119 | | - applyFrom, |
120 | | - managedVersions, |
121 | | - managedScopes, |
122 | | - managedOptionals, |
123 | | - managedLocalPaths, |
124 | | - managedExclusions); |
| 119 | + // exclude managedLocalPaths |
| 120 | + this.hashCode = Objects.hash(depth, managedVersions, managedScopes, managedOptionals, managedExclusions); |
125 | 121 | } |
126 | 122 |
|
127 | 123 | protected abstract DependencyManager newInstance( |
@@ -185,7 +181,7 @@ public DependencyManager deriveChildManager(DependencyCollectionContext context) |
185 | 181 | Collection<Exclusion> exclusions = managedDependency.getExclusions(); |
186 | 182 | if (!exclusions.isEmpty()) { |
187 | 183 | if (managedExclusions == this.managedExclusions) { |
188 | | - managedExclusions = MMap.copy(this.managedExclusions); |
| 184 | + managedExclusions = MMap.copyWithKey(key, this.managedExclusions); |
189 | 185 | } |
190 | 186 | Collection<Holder<Collection<Exclusion>>> managed = managedExclusions.get(key); |
191 | 187 | if (managed == null) { |
@@ -320,13 +316,11 @@ public boolean equals(Object obj) { |
320 | 316 | } |
321 | 317 |
|
322 | 318 | AbstractDependencyManager that = (AbstractDependencyManager) obj; |
| 319 | + // exclude managedLocalPaths |
323 | 320 | return depth == that.depth |
324 | | - && deriveUntil == that.deriveUntil |
325 | | - && applyFrom == that.applyFrom |
326 | 321 | && managedVersions.equals(that.managedVersions) |
327 | 322 | && managedScopes.equals(that.managedScopes) |
328 | 323 | && managedOptionals.equals(that.managedOptionals) |
329 | | - && managedLocalPaths.equals(that.managedLocalPaths) |
330 | 324 | && managedExclusions.equals(that.managedExclusions); |
331 | 325 | } |
332 | 326 |
|
|
0 commit comments