Merge branch '3.1.x'

Closes gh-36238
This commit is contained in:
Andy Wilkinson
2023-07-05 09:51:35 +01:00
11 changed files with 28 additions and 36 deletions

View File

@@ -21,7 +21,6 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.flywaydb.core.Flyway;
@@ -116,7 +115,7 @@ public class FlywayEndpoint {
private final List<FlywayMigrationDescriptor> migrations;
private FlywayDescriptor(MigrationInfo[] migrations) {
this.migrations = Stream.of(migrations).map(FlywayMigrationDescriptor::new).collect(Collectors.toList());
this.migrations = Stream.of(migrations).map(FlywayMigrationDescriptor::new).toList();
}
public FlywayDescriptor(List<FlywayMigrationDescriptor> migrations) {

View File

@@ -16,8 +16,6 @@
package org.springframework.boot.autoconfigure.jms.activemq;
import java.util.stream.Collectors;
import jakarta.jms.ConnectionFactory;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.commons.pool2.PooledObject;
@@ -60,8 +58,7 @@ class ActiveMQConnectionFactoryConfiguration {
private static ActiveMQConnectionFactory createJmsConnectionFactory(ActiveMQProperties properties,
ObjectProvider<ActiveMQConnectionFactoryCustomizer> factoryCustomizers) {
return new ActiveMQConnectionFactoryFactory(properties,
factoryCustomizers.orderedStream().collect(Collectors.toList()))
return new ActiveMQConnectionFactoryFactory(properties, factoryCustomizers.orderedStream().toList())
.createConnectionFactory(ActiveMQConnectionFactory.class);
}
@@ -96,7 +93,7 @@ class ActiveMQConnectionFactoryConfiguration {
JmsPoolConnectionFactory jmsConnectionFactory(ActiveMQProperties properties,
ObjectProvider<ActiveMQConnectionFactoryCustomizer> factoryCustomizers) {
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactoryFactory(properties,
factoryCustomizers.orderedStream().collect(Collectors.toList()))
factoryCustomizers.orderedStream().toList())
.createConnectionFactory(ActiveMQConnectionFactory.class);
return new JmsPoolConnectionFactoryFactory(properties.getPool())
.createPooledConnectionFactory(connectionFactory);

View File

@@ -16,8 +16,6 @@
package org.springframework.boot.autoconfigure.jms.activemq;
import java.util.stream.Collectors;
import jakarta.jms.ConnectionFactory;
import jakarta.transaction.TransactionManager;
import org.apache.activemq.ActiveMQConnectionFactory;
@@ -51,7 +49,7 @@ class ActiveMQXAConnectionFactoryConfiguration {
ObjectProvider<ActiveMQConnectionFactoryCustomizer> factoryCustomizers, XAConnectionFactoryWrapper wrapper)
throws Exception {
ActiveMQXAConnectionFactory connectionFactory = new ActiveMQConnectionFactoryFactory(properties,
factoryCustomizers.orderedStream().collect(Collectors.toList()))
factoryCustomizers.orderedStream().toList())
.createConnectionFactory(ActiveMQXAConnectionFactory.class);
return wrapper.wrapConnectionFactory(connectionFactory);
}
@@ -61,8 +59,7 @@ class ActiveMQXAConnectionFactoryConfiguration {
matchIfMissing = true)
ActiveMQConnectionFactory nonXaJmsConnectionFactory(ActiveMQProperties properties,
ObjectProvider<ActiveMQConnectionFactoryCustomizer> factoryCustomizers) {
return new ActiveMQConnectionFactoryFactory(properties,
factoryCustomizers.orderedStream().collect(Collectors.toList()))
return new ActiveMQConnectionFactoryFactory(properties, factoryCustomizers.orderedStream().toList())
.createConnectionFactory(ActiveMQConnectionFactory.class);
}

View File

@@ -17,7 +17,6 @@
package org.springframework.boot.configurationmetadata.changelog;
import java.util.List;
import java.util.stream.Collectors;
import org.junit.jupiter.api.Test;
@@ -43,13 +42,13 @@ class ChangelogTests {
List<Difference> added = differences.differences()
.stream()
.filter((difference) -> difference.type() == DifferenceType.ADDED)
.collect(Collectors.toList());
.toList();
assertThat(added).hasSize(1);
assertProperty(added.get(0).newProperty(), "test.add", String.class, "new");
List<Difference> deleted = differences.differences()
.stream()
.filter((difference) -> difference.type() == DifferenceType.DELETED)
.collect(Collectors.toList());
.toList();
assertThat(deleted).hasSize(2)
.anySatisfy((entry) -> assertProperty(entry.oldProperty(), "test.delete", String.class, "delete"))
.anySatisfy(
@@ -57,7 +56,7 @@ class ChangelogTests {
List<Difference> deprecated = differences.differences()
.stream()
.filter((difference) -> difference.type() == DifferenceType.DEPRECATED)
.collect(Collectors.toList());
.toList();
assertThat(deprecated).hasSize(1);
assertProperty(deprecated.get(0).oldProperty(), "test.deprecate", String.class, "wrong");
assertProperty(deprecated.get(0).newProperty(), "test.deprecate", String.class, "wrong");

View File

@@ -84,10 +84,10 @@ class ResolvedDependencies {
}
void resolvedArtifacts(Provider<Set<ResolvedArtifactResult>> resolvedArtifacts) {
this.artifactFiles.addAll(resolvedArtifacts
.map((artifacts) -> artifacts.stream().map(ResolvedArtifactResult::getFile).collect(Collectors.toList())));
this.artifactIds.addAll(resolvedArtifacts
.map((artifacts) -> artifacts.stream().map(ResolvedArtifactResult::getId).collect(Collectors.toList())));
this.artifactFiles.addAll(
resolvedArtifacts.map((artifacts) -> artifacts.stream().map(ResolvedArtifactResult::getFile).toList()));
this.artifactIds.addAll(
resolvedArtifacts.map((artifacts) -> artifacts.stream().map(ResolvedArtifactResult::getId).toList()));
}
DependencyDescriptor find(File file) {

View File

@@ -23,7 +23,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import org.springframework.boot.configurationmetadata.ConfigurationMetadataProperty;
import org.springframework.boot.configurationmetadata.ConfigurationMetadataRepository;
@@ -82,9 +81,7 @@ class PropertiesMigrationReporter {
private PropertySource<?> mapPropertiesWithReplacement(PropertiesMigrationReport report, String name,
List<PropertyMigration> properties) {
report.add(name, properties);
List<PropertyMigration> renamed = properties.stream()
.filter(PropertyMigration::isCompatibleType)
.collect(Collectors.toList());
List<PropertyMigration> renamed = properties.stream().filter(PropertyMigration::isCompatibleType).toList();
if (renamed.isEmpty()) {
return null;
}
@@ -118,10 +115,7 @@ class PropertiesMigrationReporter {
private Map<String, List<PropertyMigration>> getMatchingProperties(
Predicate<ConfigurationMetadataProperty> filter) {
MultiValueMap<String, PropertyMigration> result = new LinkedMultiValueMap<>();
List<ConfigurationMetadataProperty> candidates = this.allProperties.values()
.stream()
.filter(filter)
.collect(Collectors.toList());
List<ConfigurationMetadataProperty> candidates = this.allProperties.values().stream().filter(filter).toList();
getPropertySourcesAsMap().forEach((propertySourceName, propertySource) -> candidates.forEach((metadata) -> {
ConfigurationPropertyName metadataName = ConfigurationPropertyName.isValid(metadata.getId())
? ConfigurationPropertyName.of(metadata.getId())

View File

@@ -34,7 +34,6 @@ import java.util.Set;
import java.util.jar.Attributes;
import java.util.jar.JarFile;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.apache.maven.repository.internal.MavenRepositorySystemUtils;
@@ -107,7 +106,7 @@ final class ModifiedClassPathClassLoader extends URLClassLoader {
candidates.addAll(getAnnotatedElements(arguments.toArray()));
List<AnnotatedElement> annotatedElements = candidates.stream()
.filter(ModifiedClassPathClassLoader::hasAnnotation)
.collect(Collectors.toList());
.toList();
if (annotatedElements.isEmpty()) {
return null;
}