Apply Nullability changes
This commit removes the new deprecated `org.springframework.lang.Nullable` annotations and replaces them with JSpecify equivalents. Note, because those new annotations are applied on type usage, this commit not only renames imports, but also moves annotations close to the nullable usage types. Closes gh-1132
This commit is contained in:
@@ -27,6 +27,7 @@ import com.jayway.jsonpath.Configuration;
|
||||
import com.jayway.jsonpath.spi.json.JacksonJsonProvider;
|
||||
import com.jayway.jsonpath.spi.mapper.JacksonMappingProvider;
|
||||
import com.jayway.jsonpath.spi.mapper.MappingProvider;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@@ -40,7 +41,6 @@ import org.springframework.graphql.client.GraphQlClient;
|
||||
import org.springframework.graphql.client.GraphQlTransport;
|
||||
import org.springframework.graphql.support.DocumentSource;
|
||||
import org.springframework.graphql.support.ResourceDocumentSource;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
@@ -66,8 +66,7 @@ public abstract class AbstractGraphQlTesterBuilder<B extends AbstractGraphQlTest
|
||||
private static final Duration DEFAULT_RESPONSE_DURATION = Duration.ofSeconds(5);
|
||||
|
||||
|
||||
@Nullable
|
||||
private Predicate<ResponseError> errorFilter;
|
||||
private @Nullable Predicate<ResponseError> errorFilter;
|
||||
|
||||
private DocumentSource documentSource;
|
||||
|
||||
|
||||
@@ -24,11 +24,11 @@ import java.util.function.BiFunction;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import graphql.ExecutionInput;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.core.codec.Decoder;
|
||||
import org.springframework.core.codec.Encoder;
|
||||
import org.springframework.graphql.ExecutionGraphQlService;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
|
||||
@@ -46,11 +46,9 @@ final class DefaultExecutionGraphQlServiceTesterBuilder
|
||||
|
||||
private final List<BiFunction<ExecutionInput, ExecutionInput.Builder, ExecutionInput>> executionInputConfigurers;
|
||||
|
||||
@Nullable
|
||||
private Encoder<?> encoder;
|
||||
private @Nullable Encoder<?> encoder;
|
||||
|
||||
@Nullable
|
||||
private Decoder<?> decoder;
|
||||
private @Nullable Decoder<?> decoder;
|
||||
|
||||
|
||||
DefaultExecutionGraphQlServiceTesterBuilder(ExecutionGraphQlService service) {
|
||||
|
||||
@@ -31,6 +31,7 @@ import com.jayway.jsonpath.Configuration;
|
||||
import com.jayway.jsonpath.DocumentContext;
|
||||
import com.jayway.jsonpath.JsonPath;
|
||||
import com.jayway.jsonpath.TypeRef;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.skyscreamer.jsonassert.JSONAssert;
|
||||
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
@@ -41,7 +42,6 @@ import org.springframework.graphql.ResponseError;
|
||||
import org.springframework.graphql.client.GraphQlTransport;
|
||||
import org.springframework.graphql.support.DefaultGraphQlRequest;
|
||||
import org.springframework.graphql.support.DocumentSource;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.test.util.AssertionErrors;
|
||||
import org.springframework.test.util.JsonPathExpectationsHelper;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -61,8 +61,7 @@ final class DefaultGraphQlTester implements GraphQlTester {
|
||||
|
||||
private final GraphQlTransport transport;
|
||||
|
||||
@Nullable
|
||||
private final Predicate<ResponseError> errorFilter;
|
||||
private final @Nullable Predicate<ResponseError> errorFilter;
|
||||
|
||||
private final Configuration jsonPathConfig;
|
||||
|
||||
@@ -120,8 +119,7 @@ final class DefaultGraphQlTester implements GraphQlTester {
|
||||
|
||||
private final String document;
|
||||
|
||||
@Nullable
|
||||
private String operationName;
|
||||
private @Nullable String operationName;
|
||||
|
||||
List<String> fragments = new ArrayList<>();
|
||||
|
||||
@@ -173,7 +171,7 @@ final class DefaultGraphQlTester implements GraphQlTester {
|
||||
return this;
|
||||
}
|
||||
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
@SuppressWarnings({"ConstantConditions", "NullAway"})
|
||||
@Override
|
||||
public Response execute() {
|
||||
return DefaultGraphQlTester.this.transport.execute(request())
|
||||
@@ -374,8 +372,7 @@ final class DefaultGraphQlTester implements GraphQlTester {
|
||||
*/
|
||||
private static final class DefaultPath implements Path {
|
||||
|
||||
@Nullable
|
||||
private final String basePath;
|
||||
private final @Nullable String basePath;
|
||||
|
||||
private final String path;
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.util.stream.Stream;
|
||||
import com.jayway.jsonpath.Configuration;
|
||||
import com.jayway.jsonpath.TypeRef;
|
||||
import com.jayway.jsonpath.spi.mapper.MappingProvider;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.core.ResolvableType;
|
||||
import org.springframework.core.codec.Decoder;
|
||||
@@ -36,7 +37,6 @@ import org.springframework.http.MediaType;
|
||||
import org.springframework.http.codec.CodecConfigurer;
|
||||
import org.springframework.http.codec.DecoderHttpMessageReader;
|
||||
import org.springframework.http.codec.EncoderHttpMessageWriter;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.MimeType;
|
||||
import org.springframework.util.MimeTypeUtils;
|
||||
|
||||
@@ -107,21 +107,18 @@ final class EncoderDecoderMappingProvider implements MappingProvider {
|
||||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public <T> T map(Object source, Class<T> targetType, Configuration configuration) {
|
||||
public @Nullable <T> T map(Object source, Class<T> targetType, Configuration configuration) {
|
||||
return mapToTargetType(source, ResolvableType.forClass(targetType));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public <T> T map(Object source, TypeRef<T> targetType, Configuration configuration) {
|
||||
public @Nullable <T> T map(Object source, TypeRef<T> targetType, Configuration configuration) {
|
||||
return mapToTargetType(source, ResolvableType.forType(targetType.getType()));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Nullable
|
||||
private <T> T mapToTargetType(Object source, ResolvableType targetType) {
|
||||
private @Nullable <T> T mapToTargetType(Object source, ResolvableType targetType) {
|
||||
|
||||
DataBufferFactory bufferFactory = DefaultDataBufferFactory.sharedInstance;
|
||||
MimeType mimeType = MimeTypeUtils.APPLICATION_JSON;
|
||||
|
||||
@@ -22,6 +22,7 @@ import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import reactor.core.publisher.Flux;
|
||||
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
@@ -30,7 +31,6 @@ import org.springframework.graphql.ResponseError;
|
||||
import org.springframework.graphql.client.GraphQlTransport;
|
||||
import org.springframework.graphql.support.DocumentSource;
|
||||
import org.springframework.graphql.support.ResourceDocumentSource;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Define a workflow to test GraphQL requests that is independent of the
|
||||
|
||||
@@ -20,6 +20,7 @@ package org.springframework.graphql.test.tester;
|
||||
import java.net.URI;
|
||||
import java.util.Collections;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import org.springframework.graphql.ExecutionGraphQlRequest;
|
||||
@@ -28,7 +29,6 @@ import org.springframework.graphql.server.WebGraphQlHandler;
|
||||
import org.springframework.graphql.server.WebGraphQlRequest;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.codec.CodecConfigurer;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2020-2020 the original author or authors.
|
||||
* Copyright 2020-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,9 +17,7 @@
|
||||
/**
|
||||
* GraphQL client testing support.
|
||||
*/
|
||||
@NonNullApi
|
||||
@NonNullFields
|
||||
@NullMarked
|
||||
package org.springframework.graphql.test.tester;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
import org.springframework.lang.NonNullFields;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
Reference in New Issue
Block a user