mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Simplify stream chain operations
See gh-39259
This commit is contained in:
parent
15f1e8536b
commit
7f4aaacf42
@ -242,9 +242,9 @@ public abstract class UpgradeDependencies extends DefaultTask {
|
||||
}
|
||||
|
||||
private boolean isNotProhibited(Library library, DependencyVersion candidate) {
|
||||
return !library.getProhibitedVersions()
|
||||
return library.getProhibitedVersions()
|
||||
.stream()
|
||||
.anyMatch((prohibited) -> prohibited.isProhibited(candidate.toString()));
|
||||
.noneMatch((prohibited) -> prohibited.isProhibited(candidate.toString()));
|
||||
}
|
||||
|
||||
private List<Library> matchingLibraries() {
|
||||
|
@ -651,7 +651,7 @@ abstract class AbstractPackagerTests<P extends Packager> {
|
||||
expected.add("\\Q" + libraryTwo.getName() + "\\E");
|
||||
expected.add("^/META-INF/native-image/.*");
|
||||
assertThat(getPackagedEntryContent("META-INF/native-image/argfile"))
|
||||
.isEqualTo(expected.stream().collect(Collectors.joining("\n")) + "\n");
|
||||
.isEqualTo(String.join("\n", expected) + "\n");
|
||||
}
|
||||
|
||||
private File createLibraryJar() throws IOException {
|
||||
|
@ -53,7 +53,7 @@ class DisabledOnOsCondition implements ExecutionCondition {
|
||||
String architecture = System.getProperty("os.arch");
|
||||
String os = System.getProperty("os.name");
|
||||
boolean onDisabledOs = Arrays.stream(annotation.os()).anyMatch(OS::isCurrentOs);
|
||||
boolean onDisabledArchitecture = Arrays.stream(annotation.architecture()).anyMatch(architecture::equals);
|
||||
boolean onDisabledArchitecture = Arrays.asList(annotation.architecture()).contains(architecture);
|
||||
if (onDisabledOs && onDisabledArchitecture) {
|
||||
String reason = annotation.disabledReason().isEmpty()
|
||||
? String.format("Disabled on OS = %s, architecture = %s", os, architecture)
|
||||
|
@ -32,7 +32,7 @@ class IncompatibleConfigurationFailureAnalyzer extends AbstractFailureAnalyzer<I
|
||||
@Override
|
||||
protected FailureAnalysis analyze(Throwable rootFailure, IncompatibleConfigurationException cause) {
|
||||
String action = String.format("Review the docs for %s and change the configured values.",
|
||||
cause.getIncompatibleKeys().stream().collect(Collectors.joining(", ")));
|
||||
String.join(", ", cause.getIncompatibleKeys()));
|
||||
return new FailureAnalysis(cause.getMessage(), action, cause);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user