From ebbb4d319d7496f8555a3232a89efd9c320fff1a Mon Sep 17 00:00:00 2001 From: Moritz Halbritter Date: Wed, 7 Jun 2023 10:51:46 +0200 Subject: [PATCH] Polish --- .../actuate/web/exchanges/InMemoryHttpExchangeRepository.java | 4 +--- .../TestcontainersLifecycleApplicationContextInitializer.java | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/exchanges/InMemoryHttpExchangeRepository.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/exchanges/InMemoryHttpExchangeRepository.java index 367a22fe21..10cd4d555b 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/exchanges/InMemoryHttpExchangeRepository.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/exchanges/InMemoryHttpExchangeRepository.java @@ -16,8 +16,6 @@ package org.springframework.boot.actuate.web.exchanges; -import java.util.ArrayList; -import java.util.Collections; import java.util.LinkedList; import java.util.List; @@ -59,7 +57,7 @@ public class InMemoryHttpExchangeRepository implements HttpExchangeRepository { @Override public List findAll() { synchronized (this.httpExchanges) { - return Collections.unmodifiableList(new ArrayList<>(this.httpExchanges)); + return List.copyOf(this.httpExchanges); } } diff --git a/spring-boot-project/spring-boot-testcontainers/src/main/java/org/springframework/boot/testcontainers/lifecycle/TestcontainersLifecycleApplicationContextInitializer.java b/spring-boot-project/spring-boot-testcontainers/src/main/java/org/springframework/boot/testcontainers/lifecycle/TestcontainersLifecycleApplicationContextInitializer.java index 13c40c5cc6..087c4d71e6 100644 --- a/spring-boot-project/spring-boot-testcontainers/src/main/java/org/springframework/boot/testcontainers/lifecycle/TestcontainersLifecycleApplicationContextInitializer.java +++ b/spring-boot-project/spring-boot-testcontainers/src/main/java/org/springframework/boot/testcontainers/lifecycle/TestcontainersLifecycleApplicationContextInitializer.java @@ -36,7 +36,7 @@ import org.springframework.context.ConfigurableApplicationContext; public class TestcontainersLifecycleApplicationContextInitializer implements ApplicationContextInitializer { - private static Set applied = Collections.newSetFromMap(new WeakHashMap<>()); + private static final Set applied = Collections.newSetFromMap(new WeakHashMap<>()); @Override public void initialize(ConfigurableApplicationContext applicationContext) {