29
29
import java .util .function .Predicate ;
30
30
31
31
import io .micrometer .observation .ObservationRegistry ;
32
+ import org .jspecify .annotations .NonNull ;
32
33
import org .jspecify .annotations .Nullable ;
33
34
34
35
import org .springframework .core .ParameterizedTypeReference ;
@@ -714,7 +715,7 @@ interface RequestHeadersSpec<S extends RequestHeadersSpec<S>> {
714
715
* @return the value returned from the exchange function, potentially {@code null}
715
716
* @see RequestHeadersSpec#exchangeForRequiredValue(RequiredValueExchangeFunction)
716
717
*/
717
- default <T > @ Nullable T exchange (ExchangeFunction <T > exchangeFunction ) {
718
+ default <T extends @ Nullable Object > T exchange (ExchangeFunction <T > exchangeFunction ) {
718
719
return exchange (exchangeFunction , true );
719
720
}
720
721
@@ -775,7 +776,7 @@ default <T> T exchangeForRequiredValue(RequiredValueExchangeFunction<T> exchange
775
776
* @return the value returned from the exchange function, potentially {@code null}
776
777
* @see RequestHeadersSpec#exchangeForRequiredValue(RequiredValueExchangeFunction, boolean)
777
778
*/
778
- <T > @ Nullable T exchange (ExchangeFunction <T > exchangeFunction , boolean close );
779
+ <T extends @ Nullable Object > T exchange (ExchangeFunction <T > exchangeFunction , boolean close );
779
780
780
781
/**
781
782
* Exchange the {@link ClientHttpResponse} for a value of type {@code T}.
@@ -814,7 +815,7 @@ default <T> T exchangeForRequiredValue(RequiredValueExchangeFunction<T> exchange
814
815
* @param <T> the type the response will be transformed to
815
816
*/
816
817
@ FunctionalInterface
817
- interface ExchangeFunction <T > {
818
+ interface ExchangeFunction <T extends @ Nullable Object > {
818
819
819
820
/**
820
821
* Exchange the given response into a value of type {@code T}.
@@ -823,7 +824,7 @@ interface ExchangeFunction<T> {
823
824
* @return the exchanged value, potentially {@code null}
824
825
* @throws IOException in case of I/O errors
825
826
*/
826
- @ Nullable T exchange (HttpRequest clientRequest , ConvertibleClientHttpResponse clientResponse ) throws IOException ;
827
+ T exchange (HttpRequest clientRequest , ConvertibleClientHttpResponse clientResponse ) throws IOException ;
827
828
}
828
829
829
830
/**
@@ -833,7 +834,7 @@ interface ExchangeFunction<T> {
833
834
* @param <T> the type the response will be transformed to
834
835
*/
835
836
@ FunctionalInterface
836
- interface RequiredValueExchangeFunction <T > extends ExchangeFunction <T > {
837
+ interface RequiredValueExchangeFunction <T > extends ExchangeFunction <@ NonNull T > {
837
838
838
839
/**
839
840
* Exchange the given response into a value of type {@code T}.
0 commit comments