diff --git a/core/spring-boot-testcontainers/src/dockerTest/java/org/springframework/boot/testcontainers/lifecycle/TestcontainersLifecycleOrderWithScopeIntegrationTests.java b/core/spring-boot-testcontainers/src/dockerTest/java/org/springframework/boot/testcontainers/lifecycle/TestcontainersLifecycleOrderWithScopeIntegrationTests.java index bb42ef6bf231..b826e2f2be9f 100644 --- a/core/spring-boot-testcontainers/src/dockerTest/java/org/springframework/boot/testcontainers/lifecycle/TestcontainersLifecycleOrderWithScopeIntegrationTests.java +++ b/core/spring-boot-testcontainers/src/dockerTest/java/org/springframework/boot/testcontainers/lifecycle/TestcontainersLifecycleOrderWithScopeIntegrationTests.java @@ -164,7 +164,7 @@ public Object get(String name, ObjectFactory objectFactory) { } @Override - public Object remove(String name) { + public @Nullable Object remove(String name) { synchronized (this) { Object removed = this.instances.remove(name); List destructor = this.destructors.get(name); diff --git a/module/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/RestartScopeInitializer.java b/module/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/RestartScopeInitializer.java index f03bbc4b598d..8fc700b32da4 100644 --- a/module/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/RestartScopeInitializer.java +++ b/module/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/RestartScopeInitializer.java @@ -47,7 +47,7 @@ public Object get(String name, ObjectFactory objectFactory) { } @Override - public Object remove(String name) { + public @Nullable Object remove(String name) { return Restarter.getInstance().removeAttribute(name); } diff --git a/module/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/Restarter.java b/module/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/Restarter.java index ae205b0c2fd7..8727c0ace9e7 100644 --- a/module/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/Restarter.java +++ b/module/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/Restarter.java @@ -450,7 +450,7 @@ public Object getOrAddAttribute(String name, final ObjectFactory objectFactor return value; } - public Object removeAttribute(String name) { + public @Nullable Object removeAttribute(String name) { return this.attributes.remove(name); } diff --git a/module/spring-boot-webmvc-test/src/main/java/org/springframework/boot/webmvc/test/autoconfigure/WebDriverScope.java b/module/spring-boot-webmvc-test/src/main/java/org/springframework/boot/webmvc/test/autoconfigure/WebDriverScope.java index cd9019369879..44714aef4c30 100644 --- a/module/spring-boot-webmvc-test/src/main/java/org/springframework/boot/webmvc/test/autoconfigure/WebDriverScope.java +++ b/module/spring-boot-webmvc-test/src/main/java/org/springframework/boot/webmvc/test/autoconfigure/WebDriverScope.java @@ -68,7 +68,7 @@ public Object get(String name, ObjectFactory objectFactory) { } @Override - public Object remove(String name) { + public @Nullable Object remove(String name) { synchronized (this.instances) { return this.instances.remove(name); }