Skip to content

Commit 417a0b7

Browse files
committed
Add nullability annotations to module/spring-boot-http-codec
See gh-46587
1 parent de2b992 commit 417a0b7

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

module/spring-boot-http-codec/src/main/java/org/springframework/boot/http/codec/autoconfigure/CodecsAutoConfiguration.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package org.springframework.boot.http.codec.autoconfigure;
1818

1919
import com.fasterxml.jackson.databind.ObjectMapper;
20+
import org.jspecify.annotations.Nullable;
2021

2122
import org.springframework.boot.autoconfigure.AutoConfiguration;
2223
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@@ -29,7 +30,6 @@
2930
import org.springframework.context.annotation.Configuration;
3031
import org.springframework.core.Ordered;
3132
import org.springframework.core.annotation.Order;
32-
import org.springframework.core.env.Environment;
3333
import org.springframework.http.codec.CodecConfigurer;
3434
import org.springframework.util.MimeType;
3535
import org.springframework.util.unit.DataSize;
@@ -74,8 +74,7 @@ CodecCustomizer jacksonCodecCustomizer(ObjectMapper objectMapper) {
7474
static class DefaultCodecsConfiguration {
7575

7676
@Bean
77-
DefaultCodecCustomizer defaultCodecCustomizer(HttpCodecsProperties httpCodecProperties,
78-
Environment environment) {
77+
DefaultCodecCustomizer defaultCodecCustomizer(HttpCodecsProperties httpCodecProperties) {
7978
return new DefaultCodecCustomizer(httpCodecProperties.isLogRequestDetails(),
8079
httpCodecProperties.getMaxInMemorySize());
8180
}
@@ -84,9 +83,9 @@ static final class DefaultCodecCustomizer implements CodecCustomizer, Ordered {
8483

8584
private final boolean logRequestDetails;
8685

87-
private final DataSize maxInMemorySize;
86+
private final @Nullable DataSize maxInMemorySize;
8887

89-
DefaultCodecCustomizer(boolean logRequestDetails, DataSize maxInMemorySize) {
88+
DefaultCodecCustomizer(boolean logRequestDetails, @Nullable DataSize maxInMemorySize) {
9089
this.logRequestDetails = logRequestDetails;
9190
this.maxInMemorySize = maxInMemorySize;
9291
}

module/spring-boot-http-codec/src/main/java/org/springframework/boot/http/codec/autoconfigure/HttpCodecsProperties.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package org.springframework.boot.http.codec.autoconfigure;
1818

19+
import org.jspecify.annotations.Nullable;
20+
1921
import org.springframework.boot.context.properties.ConfigurationProperties;
2022
import org.springframework.util.unit.DataSize;
2123

@@ -40,7 +42,7 @@ public class HttpCodecsProperties {
4042
* WebClient instances. By default this is not set, in which case individual codec
4143
* defaults apply. Most codecs are limited to 256K by default.
4244
*/
43-
private DataSize maxInMemorySize;
45+
private @Nullable DataSize maxInMemorySize;
4446

4547
public boolean isLogRequestDetails() {
4648
return this.logRequestDetails;
@@ -50,11 +52,11 @@ public void setLogRequestDetails(boolean logRequestDetails) {
5052
this.logRequestDetails = logRequestDetails;
5153
}
5254

53-
public DataSize getMaxInMemorySize() {
55+
public @Nullable DataSize getMaxInMemorySize() {
5456
return this.maxInMemorySize;
5557
}
5658

57-
public void setMaxInMemorySize(DataSize maxInMemorySize) {
59+
public void setMaxInMemorySize(@Nullable DataSize maxInMemorySize) {
5860
this.maxInMemorySize = maxInMemorySize;
5961
}
6062

module/spring-boot-http-codec/src/main/java/org/springframework/boot/http/codec/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 HTTP codecs.
1919
*/
20+
@NullMarked
2021
package org.springframework.boot.http.codec.autoconfigure;
22+
23+
import org.jspecify.annotations.NullMarked;

module/spring-boot-http-codec/src/main/java/org/springframework/boot/http/codec/package-info.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,7 @@
1717
/**
1818
* Support for web-based codecs.
1919
*/
20+
@NullMarked
2021
package org.springframework.boot.http.codec;
22+
23+
import org.jspecify.annotations.NullMarked;

0 commit comments

Comments
 (0)