Hello, it's probably related to #1532 , but as I'm not entirely sure, I prefer to open a dedicated issue (feel free to close it if it's the same underlying problem).
I've tried activating JSpecifyMode in my project and I encounter the following false positive
return webClient
.post()
.uri(properties.accessUrl())
.contentType(MediaType.APPLICATION_FORM_URLENCODED)
.body(BodyInserters.fromFormData(formData))
.retrieve()
.toEntity(JsonNode.class)
.mapNotNull(ResponseEntity::getBody)
.mapNotNull(this::updateAccessToken)
.switchIfEmpty(Mono.error(() -> new IllegalStateException("Unable to get access token")));
The error message is
error: [NullAway] referenced method returns @Nullable, but functional interface method java.util.function.Function.apply(T) returns @NonNull
.mapNotNull(ResponseEntity::getBody)
but ResponseEntity.getBody() (from org.springframework.http.ResponseEntity) is defined as
public @Nullable T getBody() {
return this.body;
}
and Mono.mapNotNull() is defined as
public final <R> Mono<R> mapNotNull(Function <? super T, ? extends @Nullable R> mapper) {
...
}
Hello, it's probably related to #1532 , but as I'm not entirely sure, I prefer to open a dedicated issue (feel free to close it if it's the same underlying problem).
I've tried activating JSpecifyMode in my project and I encounter the following false positive
The error message is
but
ResponseEntity.getBody()(fromorg.springframework.http.ResponseEntity) is defined asand
Mono.mapNotNull()is defined as