From 99f8c4cd0d0e22aed2e6a46b35328b8d2d5ec12a Mon Sep 17 00:00:00 2001 From: Moritz Halbritter Date: Mon, 6 Oct 2025 11:52:53 +0200 Subject: [PATCH] Add nullability annotations to tests in module/spring-boot-data-ldap-test See gh-47263 --- module/spring-boot-data-ldap-test/build.gradle | 8 ++++++++ .../boot/data/ldap/test/autoconfigure/ExampleEntry.java | 8 +++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/module/spring-boot-data-ldap-test/build.gradle b/module/spring-boot-data-ldap-test/build.gradle index 48b086a5255..b4dedcceca7 100644 --- a/module/spring-boot-data-ldap-test/build.gradle +++ b/module/spring-boot-data-ldap-test/build.gradle @@ -44,3 +44,11 @@ dependencies { 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-data-ldap-test/src/test/java/org/springframework/boot/data/ldap/test/autoconfigure/ExampleEntry.java b/module/spring-boot-data-ldap-test/src/test/java/org/springframework/boot/data/ldap/test/autoconfigure/ExampleEntry.java index a59ff35ef90..ee7643a9de3 100644 --- a/module/spring-boot-data-ldap-test/src/test/java/org/springframework/boot/data/ldap/test/autoconfigure/ExampleEntry.java +++ b/module/spring-boot-data-ldap-test/src/test/java/org/springframework/boot/data/ldap/test/autoconfigure/ExampleEntry.java @@ -18,6 +18,8 @@ package org.springframework.boot.data.ldap.test.autoconfigure; import javax.naming.Name; +import org.jspecify.annotations.Nullable; + import org.springframework.ldap.odm.annotations.Entry; import org.springframework.ldap.odm.annotations.Id; @@ -30,13 +32,13 @@ import org.springframework.ldap.odm.annotations.Id; public class ExampleEntry { @Id - private Name dn; + private @Nullable Name dn; - public Name getDn() { + public @Nullable Name getDn() { return this.dn; } - public void setDn(Name dn) { + public void setDn(@Nullable Name dn) { this.dn = dn; }