Add nullability annotations to tests in module/spring-boot-gson

See gh-47263
This commit is contained in:
Moritz Halbritter
2025-10-06 12:03:55 +02:00
parent 09311ff44e
commit 80436abbb6
3 changed files with 8 additions and 2 deletions
+4
View File
@@ -36,3 +36,7 @@ dependencies {
testRuntimeOnly("ch.qos.logback:logback-classic")
}
tasks.named("compileTestJava") {
options.nullability.checking = "tests"
}
@@ -17,6 +17,7 @@
package org.springframework.boot.gson.autoconfigure;
import com.google.gson.Gson;
import org.jspecify.annotations.Nullable;
import org.junit.jupiter.api.Test;
import org.springframework.boot.autoconfigure.AutoConfigurations;
@@ -52,7 +53,7 @@ class Gson210AutoConfigurationTests {
private Long data = 1L;
@SuppressWarnings("unused")
private final String owner = null;
private final @Nullable String owner = null;
public void setData(Long data) {
this.data = data;
@@ -29,6 +29,7 @@ import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.LongSerializationPolicy;
import com.google.gson.Strictness;
import org.jspecify.annotations.Nullable;
import org.junit.jupiter.api.Test;
import org.skyscreamer.jsonassert.JSONAssert;
@@ -310,7 +311,7 @@ class GsonAutoConfigurationTests {
private Long data = 1L;
@SuppressWarnings("unused")
private final String owner = null;
private final @Nullable String owner = null;
public void setData(Long data) {
this.data = data;