Merge branch '3.1.x'
Closes gh-36238
This commit is contained in:
@@ -70,15 +70,15 @@ public abstract class ArchitectureCheck extends DefaultTask {
|
||||
@TaskAction
|
||||
void checkArchitecture() throws IOException {
|
||||
JavaClasses javaClasses = new ClassFileImporter()
|
||||
.importPaths(this.classes.getFiles().stream().map(File::toPath).collect(Collectors.toList()));
|
||||
.importPaths(this.classes.getFiles().stream().map(File::toPath).toList());
|
||||
List<EvaluationResult> violations = Stream.of(allPackagesShouldBeFreeOfTangles(),
|
||||
allBeanPostProcessorBeanMethodsShouldBeStaticAndHaveParametersThatWillNotCausePrematureInitialization(),
|
||||
allBeanFactoryPostProcessorBeanMethodsShouldBeStaticAndHaveNoParameters(),
|
||||
noClassesShouldCallStepVerifierStepVerifyComplete(),
|
||||
noClassesShouldConfigureDefaultStepVerifierTimeout())
|
||||
noClassesShouldConfigureDefaultStepVerifierTimeout(), noClassesShouldCallCollectorsToList())
|
||||
.map((rule) -> rule.evaluate(javaClasses))
|
||||
.filter(EvaluationResult::hasViolation)
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
File outputFile = getOutputDirectory().file("failure-report.txt").get().getAsFile();
|
||||
outputFile.getParentFile().mkdirs();
|
||||
if (!violations.isEmpty()) {
|
||||
@@ -178,6 +178,13 @@ public abstract class ArchitectureCheck extends DefaultTask {
|
||||
.because("expectComplete().verify(Duration) should be used instead");
|
||||
}
|
||||
|
||||
private ArchRule noClassesShouldCallCollectorsToList() {
|
||||
return ArchRuleDefinition.noClasses()
|
||||
.should()
|
||||
.callMethod(Collectors.class, "toList")
|
||||
.because("java.util.stream.Stream.toList() should be used instead");
|
||||
}
|
||||
|
||||
public void setClasses(FileCollection classes) {
|
||||
this.classes = classes;
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ class StandardLibraryUpdateResolver implements LibraryUpdateResolver {
|
||||
.flatMap(SortedSet::stream)
|
||||
.distinct()
|
||||
.filter((dependencyVersion) -> isPermitted(dependencyVersion, library.getProhibitedVersions()))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
if (allVersions.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user