Skip to content

Commit ecc9a23

Browse files
committed
Polish "Use constructor rather than Collection.addAll"
See gh-41053
1 parent 17adcfc commit ecc9a23

File tree

6 files changed

+8
-9
lines changed

6 files changed

+8
-9
lines changed

buildSrc/src/main/java/org/springframework/boot/build/toolchain/ToolchainPlugin.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ private void disableToolchainTasks(Project project) {
7171
}
7272

7373
private void configureTestToolchain(Project project, ToolchainExtension toolchain) {
74-
List<String> jvmArgs = new ArrayList<>();
75-
jvmArgs.addAll(toolchain.getTestJvmArgs().getOrElse(Collections.emptyList()));
74+
List<String> jvmArgs = new ArrayList<>(toolchain.getTestJvmArgs().getOrElse(Collections.emptyList()));
7675
project.getTasks().withType(Test.class, (test) -> test.jvmArgs(jvmArgs));
7776
}
7877

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/NativeImageResourceProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

spring-boot-project/spring-boot-testcontainers/src/main/java/org/springframework/boot/testcontainers/service/connection/ServiceConnectionAutoConfigurationRegistrar.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -68,7 +68,8 @@ private void registerBeanDefinitions(ConfigurableListableBeanFactory beanFactory
6868

6969
private Set<ServiceConnection> getAnnotations(ConfigurableListableBeanFactory beanFactory, String beanName,
7070
BeanDefinition beanDefinition) {
71-
Set<ServiceConnection> annotations = new LinkedHashSet<>(beanFactory.findAllAnnotationsOnBean(beanName, ServiceConnection.class, false));
71+
Set<ServiceConnection> annotations = new LinkedHashSet<>(
72+
beanFactory.findAllAnnotationsOnBean(beanName, ServiceConnection.class, false));
7273
if (beanDefinition instanceof TestcontainerBeanDefinition testcontainerBeanDefinition) {
7374
testcontainerBeanDefinition.getAnnotations()
7475
.stream(ServiceConnection.class)

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigData.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,7 @@ public Options with(Option option) {
239239
}
240240

241241
private Options copy(Consumer<EnumSet<Option>> processor) {
242-
EnumSet<Option> options = EnumSet.noneOf(Option.class);
243-
options.addAll(this.options);
242+
EnumSet<Option> options = EnumSet.copyOf(this.options);
244243
processor.accept(options);
245244
return new Options(options);
246245
}

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TldPatterns.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatEmbeddedContext.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2022 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)