mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-05 00:56:58 +08:00
Use Comparator.comparing
See gh-33987
This commit is contained in:
parent
d3efd7e091
commit
55a50d565c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -16,10 +16,12 @@
|
||||
|
||||
package org.springframework.boot.build.testing;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import org.gradle.api.DefaultTask;
|
||||
import org.gradle.api.services.BuildService;
|
||||
import org.gradle.api.services.BuildServiceParameters;
|
||||
import org.gradle.api.tasks.testing.Test;
|
||||
@ -35,8 +37,7 @@ import org.gradle.tooling.events.OperationCompletionListener;
|
||||
public abstract class TestResultsOverview
|
||||
implements BuildService<BuildServiceParameters.None>, OperationCompletionListener, AutoCloseable {
|
||||
|
||||
private final Map<Test, List<TestFailure>> testFailures = new TreeMap<>(
|
||||
(one, two) -> one.getPath().compareTo(two.getPath()));
|
||||
private final Map<Test, List<TestFailure>> testFailures = new TreeMap<>(Comparator.comparing(DefaultTask::getPath));
|
||||
|
||||
private final Object monitor = new Object();
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -18,6 +18,7 @@ package org.springframework.boot.diagnostics.analyzer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
@ -83,7 +84,7 @@ class MutuallyExclusiveConfigurationPropertiesFailureAnalyzer
|
||||
|
||||
private void appendDetails(StringBuilder message, MutuallyExclusiveConfigurationPropertiesException cause,
|
||||
List<Descriptor> descriptors) {
|
||||
descriptors.sort((d1, d2) -> d1.propertyName.compareTo(d2.propertyName));
|
||||
descriptors.sort(Comparator.comparing((descriptor) -> descriptor.propertyName));
|
||||
message.append(String.format("The following configuration properties are mutually exclusive:%n%n"));
|
||||
sortedStrings(cause.getMutuallyExclusiveNames())
|
||||
.forEach((name) -> message.append(String.format("\t%s%n", name)));
|
||||
|
Loading…
Reference in New Issue
Block a user