Skip to content

Commit 1b6aa9e

Browse files
committed
Add more nullability annotations to module/spring-boot-actuator
See gh-46587
1 parent 5321acd commit 1b6aa9e

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

module/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/annotation/EndpointDiscoverer.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,8 @@ private boolean isFilterMatch(EndpointFilter<E> filter, EndpointBean endpointBea
338338
return isFilterMatch(filter, getFilterEndpoint(endpointBean));
339339
}
340340

341-
@SuppressWarnings({ "unchecked" })
341+
// Doesn't detect lambda with correct nullability
342+
@SuppressWarnings({ "unchecked", "NullAway" })
342343
private boolean isFilterMatch(EndpointFilter<E> filter, E endpoint) {
343344
Boolean result = LambdaSafe.callback(EndpointFilter.class, filter, endpoint)
344345
.withLogger(EndpointDiscoverer.class)
@@ -357,7 +358,8 @@ private boolean isOperationFiltered(Operation operation, EndpointId endpointId,
357358
return false;
358359
}
359360

360-
@SuppressWarnings("unchecked")
361+
// Doesn't detect lambda with correct nullability
362+
@SuppressWarnings({ "unchecked", "NullAway" })
361363
private boolean isFilterMatch(OperationFilter<O> filter, Operation operation, EndpointId endpointId,
362364
Access defaultAccess) {
363365
Boolean result = LambdaSafe.callback(OperationFilter.class, filter, operation)

module/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthEndpointWebExtension.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,9 @@ public WebEndpointResponse<HealthDescriptor> health(ApiVersion apiVersion, WebSe
8080
return health(apiVersion, serverNamespace, securityContext, false, path);
8181
}
8282

83-
public WebEndpointResponse<HealthDescriptor> health(ApiVersion apiVersion, WebServerNamespace serverNamespace,
84-
SecurityContext securityContext, boolean showAll, String... path) {
83+
public WebEndpointResponse<HealthDescriptor> health(ApiVersion apiVersion,
84+
@Nullable WebServerNamespace serverNamespace, SecurityContext securityContext, boolean showAll,
85+
String... path) {
8586
Result<HealthDescriptor> result = getResult(apiVersion, serverNamespace, securityContext, showAll, path);
8687
if (result == null) {
8788
return (Arrays.equals(path, EMPTY_PATH))

module/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/ReactiveHealthEndpointWebExtension.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ public Mono<WebEndpointResponse<? extends HealthDescriptor>> health(ApiVersion a
8181
}
8282

8383
public Mono<WebEndpointResponse<? extends HealthDescriptor>> health(ApiVersion apiVersion,
84-
WebServerNamespace serverNamespace, SecurityContext securityContext, boolean showAll, String... path) {
84+
@Nullable WebServerNamespace serverNamespace, SecurityContext securityContext, boolean showAll,
85+
String... path) {
8586
Result<Mono<? extends HealthDescriptor>> result = getResult(apiVersion, serverNamespace, securityContext,
8687
showAll, path);
8788
if (result == null) {

0 commit comments

Comments
 (0)