Skip to content

Commit e27009d

Browse files
committed
Add nullability annotations to module/spring-boot-thymeleaf
See gh-46587
1 parent f52c882 commit e27009d

File tree

2 files changed

+23
-18
lines changed

2 files changed

+23
-18
lines changed

module/spring-boot-thymeleaf/src/main/java/org/springframework/boot/thymeleaf/autoconfigure/ThymeleafProperties.java

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
import java.nio.charset.StandardCharsets;
2121
import java.util.List;
2222

23+
import org.jspecify.annotations.Nullable;
24+
2325
import org.springframework.boot.context.properties.ConfigurationProperties;
2426
import org.springframework.http.MediaType;
2527
import org.springframework.util.MimeType;
@@ -83,17 +85,17 @@ public class ThymeleafProperties {
8385
* first in the chain. Order start at 1 and should only be set if you have defined
8486
* additional "TemplateResolver" beans.
8587
*/
86-
private Integer templateResolverOrder;
88+
private @Nullable Integer templateResolverOrder;
8789

8890
/**
8991
* List of view names (patterns allowed) that can be resolved.
9092
*/
91-
private String[] viewNames;
93+
private String @Nullable [] viewNames;
9294

9395
/**
9496
* List of view names (patterns allowed) that should be excluded from resolution.
9597
*/
96-
private String[] excludedViewNames;
98+
private String @Nullable [] excludedViewNames;
9799

98100
/**
99101
* Enable the SpringEL compiler in SpringEL expressions.
@@ -179,27 +181,27 @@ public void setCache(boolean cache) {
179181
this.cache = cache;
180182
}
181183

182-
public Integer getTemplateResolverOrder() {
184+
public @Nullable Integer getTemplateResolverOrder() {
183185
return this.templateResolverOrder;
184186
}
185187

186-
public void setTemplateResolverOrder(Integer templateResolverOrder) {
188+
public void setTemplateResolverOrder(@Nullable Integer templateResolverOrder) {
187189
this.templateResolverOrder = templateResolverOrder;
188190
}
189191

190-
public String[] getExcludedViewNames() {
192+
public String @Nullable [] getExcludedViewNames() {
191193
return this.excludedViewNames;
192194
}
193195

194-
public void setExcludedViewNames(String[] excludedViewNames) {
196+
public void setExcludedViewNames(String @Nullable [] excludedViewNames) {
195197
this.excludedViewNames = excludedViewNames;
196198
}
197199

198-
public String[] getViewNames() {
200+
public String @Nullable [] getViewNames() {
199201
return this.viewNames;
200202
}
201203

202-
public void setViewNames(String[] viewNames) {
204+
public void setViewNames(String @Nullable [] viewNames) {
203205
this.viewNames = viewNames;
204206
}
205207

@@ -269,25 +271,25 @@ public static class Reactive {
269271
/**
270272
* Media types supported by the view technology.
271273
*/
272-
private List<MediaType> mediaTypes;
274+
private @Nullable List<MediaType> mediaTypes;
273275

274276
/**
275277
* Comma-separated list of view names (patterns allowed) that should be executed
276278
* in FULL mode even if a max chunk size is set.
277279
*/
278-
private String[] fullModeViewNames;
280+
private String @Nullable [] fullModeViewNames;
279281

280282
/**
281283
* Comma-separated list of view names (patterns allowed) that should be the only
282284
* ones executed in CHUNKED mode when a max chunk size is set.
283285
*/
284-
private String[] chunkedModeViewNames;
286+
private String @Nullable [] chunkedModeViewNames;
285287

286-
public List<MediaType> getMediaTypes() {
288+
public @Nullable List<MediaType> getMediaTypes() {
287289
return this.mediaTypes;
288290
}
289291

290-
public void setMediaTypes(List<MediaType> mediaTypes) {
292+
public void setMediaTypes(@Nullable List<MediaType> mediaTypes) {
291293
this.mediaTypes = mediaTypes;
292294
}
293295

@@ -299,19 +301,19 @@ public void setMaxChunkSize(DataSize maxChunkSize) {
299301
this.maxChunkSize = maxChunkSize;
300302
}
301303

302-
public String[] getFullModeViewNames() {
304+
public String @Nullable [] getFullModeViewNames() {
303305
return this.fullModeViewNames;
304306
}
305307

306-
public void setFullModeViewNames(String[] fullModeViewNames) {
308+
public void setFullModeViewNames(String @Nullable [] fullModeViewNames) {
307309
this.fullModeViewNames = fullModeViewNames;
308310
}
309311

310-
public String[] getChunkedModeViewNames() {
312+
public String @Nullable [] getChunkedModeViewNames() {
311313
return this.chunkedModeViewNames;
312314
}
313315

314-
public void setChunkedModeViewNames(String[] chunkedModeViewNames) {
316+
public void setChunkedModeViewNames(String @Nullable [] chunkedModeViewNames) {
315317
this.chunkedModeViewNames = chunkedModeViewNames;
316318
}
317319

module/spring-boot-thymeleaf/src/main/java/org/springframework/boot/thymeleaf/autoconfigure/package-info.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,7 @@
1717
/**
1818
* Auto-configuration for Thymeleaf.
1919
*/
20+
@NullMarked
2021
package org.springframework.boot.thymeleaf.autoconfigure;
22+
23+
import org.jspecify.annotations.NullMarked;

0 commit comments

Comments
 (0)