Merge branch '2.7.x' into 3.0.x

pull/35611/head
Moritz Halbritter 2 years ago
commit 7b4056df7f

@ -18,7 +18,6 @@ package org.springframework.boot.build.classpath;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Set; import java.util.Set;
@ -107,14 +106,13 @@ public class CheckClasspathForUnnecessaryExclusions extends DefaultTask {
this.exclusionsByDependencyId.forEach((dependencyId, exclusions) -> { this.exclusionsByDependencyId.forEach((dependencyId, exclusions) -> {
if (!exclusions.isEmpty()) { if (!exclusions.isEmpty()) {
Dependency toCheck = this.dependencyById.get(dependencyId); Dependency toCheck = this.dependencyById.get(dependencyId);
List<String> dependencies = this.configurations.detachedConfiguration(toCheck, this.platform) this.configurations.detachedConfiguration(toCheck, this.platform)
.getIncoming() .getIncoming()
.getArtifacts() .getArtifacts()
.getArtifacts() .getArtifacts()
.stream() .stream()
.map(this::getId) .map(this::getId)
.toList(); .forEach(exclusions::remove);
exclusions.removeAll(dependencies);
removeProfileExclusions(dependencyId, exclusions); removeProfileExclusions(dependencyId, exclusions);
if (!exclusions.isEmpty()) { if (!exclusions.isEmpty()) {
unnecessaryExclusions.put(dependencyId, exclusions); unnecessaryExclusions.put(dependencyId, exclusions);

@ -147,7 +147,7 @@ public final class ConditionEvaluationReport {
*/ */
public Set<String> getUnconditionalClasses() { public Set<String> getUnconditionalClasses() {
Set<String> filtered = new HashSet<>(this.unconditionalClasses); Set<String> filtered = new HashSet<>(this.unconditionalClasses);
filtered.removeAll(this.exclusions); this.exclusions.forEach(filtered::remove);
return Collections.unmodifiableSet(filtered); return Collections.unmodifiableSet(filtered);
} }
@ -166,7 +166,7 @@ public final class ConditionEvaluationReport {
* @return the {@link ConditionEvaluationReport} or {@code null} * @return the {@link ConditionEvaluationReport} or {@code null}
*/ */
public static ConditionEvaluationReport find(BeanFactory beanFactory) { public static ConditionEvaluationReport find(BeanFactory beanFactory) {
if (beanFactory != null && beanFactory instanceof ConfigurableListableBeanFactory) { if (beanFactory instanceof ConfigurableListableBeanFactory) {
return ConditionEvaluationReport.get((ConfigurableListableBeanFactory) beanFactory); return ConditionEvaluationReport.get((ConfigurableListableBeanFactory) beanFactory);
} }
return null; return null;

@ -75,7 +75,7 @@ public final class ErrorAttributeOptions {
*/ */
public ErrorAttributeOptions excluding(Include... excludes) { public ErrorAttributeOptions excluding(Include... excludes) {
EnumSet<Include> updated = copyIncludes(); EnumSet<Include> updated = copyIncludes();
updated.removeAll(Arrays.asList(excludes)); Arrays.stream(excludes).forEach(updated::remove);
return new ErrorAttributeOptions(Collections.unmodifiableSet(updated)); return new ErrorAttributeOptions(Collections.unmodifiableSet(updated));
} }

Loading…
Cancel
Save