From 0634c11eee8f6f5eadea1335bd61aa994fc2f79f Mon Sep 17 00:00:00 2001 From: Moritz Halbritter Date: Fri, 26 Sep 2025 12:29:30 +0200 Subject: [PATCH] Add nullability annotations to tests in module/spring-boot-hazelcast See gh-47263 --- module/spring-boot-hazelcast/build.gradle | 8 ++++++++ .../HazelcastAutoConfigurationServerTests.java | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/module/spring-boot-hazelcast/build.gradle b/module/spring-boot-hazelcast/build.gradle index 9055a423f30..2b6087c120d 100644 --- a/module/spring-boot-hazelcast/build.gradle +++ b/module/spring-boot-hazelcast/build.gradle @@ -54,3 +54,11 @@ dependencies { testRuntimeOnly("com.h2database:h2") testRuntimeOnly("ch.qos.logback:logback-classic") } + +tasks.named("compileTestJava") { + options.nullability.checking = "tests" +} + +tasks.named("compileDockerTestJava") { + options.nullability.checking = "tests" +} diff --git a/module/spring-boot-hazelcast/src/test/java/org/springframework/boot/hazelcast/autoconfigure/HazelcastAutoConfigurationServerTests.java b/module/spring-boot-hazelcast/src/test/java/org/springframework/boot/hazelcast/autoconfigure/HazelcastAutoConfigurationServerTests.java index baf7d8fc817..b223058c1ff 100644 --- a/module/spring-boot-hazelcast/src/test/java/org/springframework/boot/hazelcast/autoconfigure/HazelcastAutoConfigurationServerTests.java +++ b/module/spring-boot-hazelcast/src/test/java/org/springframework/boot/hazelcast/autoconfigure/HazelcastAutoConfigurationServerTests.java @@ -31,6 +31,7 @@ import com.hazelcast.map.EntryProcessor; import com.hazelcast.map.IMap; import com.hazelcast.spring.context.SpringAware; import com.hazelcast.spring.context.SpringManagedContext; +import org.jspecify.annotations.Nullable; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; @@ -319,7 +320,7 @@ class HazelcastAutoConfigurationServerTests { private Environment environment; @Override - public String process(Map.Entry entry) { + public @Nullable String process(Map.Entry entry) { return this.environment.getProperty(entry.getKey()); }