From 84dac20b7be342b515db7ea5d4baf5781bee50c5 Mon Sep 17 00:00:00 2001 From: rstoyanchev Date: Mon, 20 May 2024 16:33:46 +0100 Subject: [PATCH] Fix compiler "deprecation" warnings --- .../graphql/server/WebGraphQlRequest.java | 14 +++--- .../server/WebSocketGraphQlRequest.java | 44 +++++++++---------- .../data/query/QuerydslDataFetcherTests.java | 2 +- .../QueryByExampleDataFetcherJpaTests.java | 2 +- ...QueryByExampleDataFetcherMongoDbTests.java | 2 +- ...xampleDataFetcherReactiveMongoDbTests.java | 2 +- .../QueryByExampleDataFetcherNeo4jTests.java | 2 +- ...xampleDataFetcherReactiveNeo4jDbTests.java | 2 +- .../server/WebGraphQlHandlerTests.java | 2 +- .../server/WebGraphQlInterceptorTests.java | 2 +- 10 files changed, 37 insertions(+), 37 deletions(-) diff --git a/spring-graphql/src/main/java/org/springframework/graphql/server/WebGraphQlRequest.java b/spring-graphql/src/main/java/org/springframework/graphql/server/WebGraphQlRequest.java index 2dd5bb9f..52c735e7 100644 --- a/spring-graphql/src/main/java/org/springframework/graphql/server/WebGraphQlRequest.java +++ b/spring-graphql/src/main/java/org/springframework/graphql/server/WebGraphQlRequest.java @@ -76,16 +76,17 @@ public class WebGraphQlRequest extends DefaultExecutionGraphQlRequest implements * @param locale the locale from the HTTP request, if any * @since 1.3.0 */ - public WebGraphQlRequest(URI uri, HttpHeaders headers, @Nullable MultiValueMap cookies, - @Nullable InetSocketAddress remoteAddress, Map attributes, - GraphQlRequest body, String id, @Nullable Locale locale) { + public WebGraphQlRequest( + URI uri, HttpHeaders headers, @Nullable MultiValueMap cookies, + @Nullable InetSocketAddress remoteAddress, Map attributes, + GraphQlRequest body, String id, @Nullable Locale locale) { + this(uri, headers, cookies, remoteAddress, attributes, body.getDocument(), body.getOperationName(), body.getVariables(), body.getExtensions(), id, locale); } /** - * Variant of {@link #WebGraphQlRequest(URI, HttpHeaders, MultiValueMap, Map, GraphQlRequest, String, Locale)} - * with a Map for the request body. + * Constructor variant with a Map for the request body. * @param uri the URL for the HTTP request or WebSocket handshake * @param headers the HTTP request headers * @param cookies the HTTP request cookies @@ -127,8 +128,7 @@ public class WebGraphQlRequest extends DefaultExecutionGraphQlRequest implements } /** - * Variant of {@link #WebGraphQlRequest(URI, HttpHeaders, MultiValueMap, Map, GraphQlRequest, String, Locale)} - * with a Map for the request body. + * Create an instance. * @param uri the URL for the HTTP request or WebSocket handshake * @param headers the HTTP request headers * @param cookies the HTTP request cookies diff --git a/spring-graphql/src/main/java/org/springframework/graphql/server/WebSocketGraphQlRequest.java b/spring-graphql/src/main/java/org/springframework/graphql/server/WebSocketGraphQlRequest.java index f81c8995..fc50ee17 100644 --- a/spring-graphql/src/main/java/org/springframework/graphql/server/WebSocketGraphQlRequest.java +++ b/spring-graphql/src/main/java/org/springframework/graphql/server/WebSocketGraphQlRequest.java @@ -41,28 +41,6 @@ public class WebSocketGraphQlRequest extends WebGraphQlRequest { private final WebSocketSessionInfo sessionInfo; - /** - * Create an instance. - * @param uri the URL for the HTTP request or WebSocket handshake - * @param headers the HTTP request headers - * @param cookies the HTTP request cookies - * @param attributes session attributes - * @param body the deserialized content of the GraphQL request - * @param id the id from the GraphQL over WebSocket {@code "subscribe"} message - * @param locale the locale from the HTTP request, if any - * @param sessionInfo the WebSocket session id - * @since 1.1.3 - * @deprecated in favor of {@link #WebSocketGraphQlRequest(URI, HttpHeaders, MultiValueMap, InetSocketAddress, Map, Map, String, Locale, WebSocketSessionInfo)} - */ - @Deprecated(since = "1.3.0", forRemoval = true) - public WebSocketGraphQlRequest( - URI uri, HttpHeaders headers, @Nullable MultiValueMap cookies, - Map attributes, Map body, String id, @Nullable Locale locale, - WebSocketSessionInfo sessionInfo) { - - this(uri, headers, cookies, null, attributes, body, id, locale, sessionInfo); - } - /** * Create an instance. * @param uri the URL for the HTTP request or WebSocket handshake @@ -86,6 +64,28 @@ public class WebSocketGraphQlRequest extends WebGraphQlRequest { this.sessionInfo = sessionInfo; } + /** + * Create an instance. + * @param uri the URL for the HTTP request or WebSocket handshake + * @param headers the HTTP request headers + * @param cookies the HTTP request cookies + * @param attributes session attributes + * @param body the deserialized content of the GraphQL request + * @param id the id from the GraphQL over WebSocket {@code "subscribe"} message + * @param locale the locale from the HTTP request, if any + * @param sessionInfo the WebSocket session id + * @since 1.1.3 + * @deprecated in favor of {@link #WebSocketGraphQlRequest(URI, HttpHeaders, MultiValueMap, InetSocketAddress, Map, Map, String, Locale, WebSocketSessionInfo)} + */ + @Deprecated(since = "1.3.0", forRemoval = true) + public WebSocketGraphQlRequest( + URI uri, HttpHeaders headers, @Nullable MultiValueMap cookies, + Map attributes, Map body, String id, @Nullable Locale locale, + WebSocketSessionInfo sessionInfo) { + + this(uri, headers, cookies, null, attributes, body, id, locale, sessionInfo); + } + /** * Return information about the underlying WebSocket session. diff --git a/spring-graphql/src/test/java/org/springframework/graphql/data/query/QuerydslDataFetcherTests.java b/spring-graphql/src/test/java/org/springframework/graphql/data/query/QuerydslDataFetcherTests.java index ea8179a2..70b8b2ac 100644 --- a/spring-graphql/src/test/java/org/springframework/graphql/data/query/QuerydslDataFetcherTests.java +++ b/spring-graphql/src/test/java/org/springframework/graphql/data/query/QuerydslDataFetcherTests.java @@ -376,7 +376,7 @@ class QuerydslDataFetcherTests { private WebGraphQlRequest request(String query) { return new WebGraphQlRequest( - URI.create("/"), new HttpHeaders(), null, Collections.emptyMap(), + URI.create("/"), new HttpHeaders(), null, null, Collections.emptyMap(), new DefaultGraphQlRequest(query), "1", Locale.ENGLISH); } diff --git a/spring-graphql/src/test/java/org/springframework/graphql/data/query/jpa/QueryByExampleDataFetcherJpaTests.java b/spring-graphql/src/test/java/org/springframework/graphql/data/query/jpa/QueryByExampleDataFetcherJpaTests.java index 723eaa14..97667e63 100644 --- a/spring-graphql/src/test/java/org/springframework/graphql/data/query/jpa/QueryByExampleDataFetcherJpaTests.java +++ b/spring-graphql/src/test/java/org/springframework/graphql/data/query/jpa/QueryByExampleDataFetcherJpaTests.java @@ -262,7 +262,7 @@ class QueryByExampleDataFetcherJpaTests { private WebGraphQlRequest request(String query) { return new WebGraphQlRequest( - URI.create("/"), new HttpHeaders(), null, Collections.emptyMap(), + URI.create("/"), new HttpHeaders(), null, null, Collections.emptyMap(), new DefaultGraphQlRequest(query), "1", null); } diff --git a/spring-graphql/src/test/java/org/springframework/graphql/data/query/mongo/QueryByExampleDataFetcherMongoDbTests.java b/spring-graphql/src/test/java/org/springframework/graphql/data/query/mongo/QueryByExampleDataFetcherMongoDbTests.java index 1fc64ae5..8796a867 100644 --- a/spring-graphql/src/test/java/org/springframework/graphql/data/query/mongo/QueryByExampleDataFetcherMongoDbTests.java +++ b/spring-graphql/src/test/java/org/springframework/graphql/data/query/mongo/QueryByExampleDataFetcherMongoDbTests.java @@ -240,7 +240,7 @@ class QueryByExampleDataFetcherMongoDbTests { private WebGraphQlRequest request(String query) { return new WebGraphQlRequest( - URI.create("/"), new HttpHeaders(), null, Collections.emptyMap(), + URI.create("/"), new HttpHeaders(), null, null, Collections.emptyMap(), new DefaultGraphQlRequest(query), "1", null); } diff --git a/spring-graphql/src/test/java/org/springframework/graphql/data/query/mongo/QueryByExampleDataFetcherReactiveMongoDbTests.java b/spring-graphql/src/test/java/org/springframework/graphql/data/query/mongo/QueryByExampleDataFetcherReactiveMongoDbTests.java index ac42113a..20168c94 100644 --- a/spring-graphql/src/test/java/org/springframework/graphql/data/query/mongo/QueryByExampleDataFetcherReactiveMongoDbTests.java +++ b/spring-graphql/src/test/java/org/springframework/graphql/data/query/mongo/QueryByExampleDataFetcherReactiveMongoDbTests.java @@ -213,7 +213,7 @@ class QueryByExampleDataFetcherReactiveMongoDbTests { private WebGraphQlRequest request(String query) { return new WebGraphQlRequest( - URI.create("/"), new HttpHeaders(), null, Collections.emptyMap(), + URI.create("/"), new HttpHeaders(), null, null, Collections.emptyMap(), new DefaultGraphQlRequest(query), "1", null); } diff --git a/spring-graphql/src/test/java/org/springframework/graphql/data/query/neo4j/QueryByExampleDataFetcherNeo4jTests.java b/spring-graphql/src/test/java/org/springframework/graphql/data/query/neo4j/QueryByExampleDataFetcherNeo4jTests.java index 359f6cf8..20637d3f 100644 --- a/spring-graphql/src/test/java/org/springframework/graphql/data/query/neo4j/QueryByExampleDataFetcherNeo4jTests.java +++ b/spring-graphql/src/test/java/org/springframework/graphql/data/query/neo4j/QueryByExampleDataFetcherNeo4jTests.java @@ -242,7 +242,7 @@ class QueryByExampleDataFetcherNeo4jTests { private WebGraphQlRequest request(String query) { return new WebGraphQlRequest( - URI.create("/"), new HttpHeaders(), null, Collections.emptyMap(), + URI.create("/"), new HttpHeaders(), null, null, Collections.emptyMap(), new DefaultGraphQlRequest(query), "1", null); } diff --git a/spring-graphql/src/test/java/org/springframework/graphql/data/query/neo4j/QueryByExampleDataFetcherReactiveNeo4jDbTests.java b/spring-graphql/src/test/java/org/springframework/graphql/data/query/neo4j/QueryByExampleDataFetcherReactiveNeo4jDbTests.java index 4a562ecb..cd1af697 100644 --- a/spring-graphql/src/test/java/org/springframework/graphql/data/query/neo4j/QueryByExampleDataFetcherReactiveNeo4jDbTests.java +++ b/spring-graphql/src/test/java/org/springframework/graphql/data/query/neo4j/QueryByExampleDataFetcherReactiveNeo4jDbTests.java @@ -226,7 +226,7 @@ class QueryByExampleDataFetcherReactiveNeo4jDbTests { private WebGraphQlRequest request(String query) { return new WebGraphQlRequest( - URI.create("/"), new HttpHeaders(), null, Collections.emptyMap(), + URI.create("/"), new HttpHeaders(), null, null, Collections.emptyMap(), new DefaultGraphQlRequest(query), "1", null); } diff --git a/spring-graphql/src/test/java/org/springframework/graphql/server/WebGraphQlHandlerTests.java b/spring-graphql/src/test/java/org/springframework/graphql/server/WebGraphQlHandlerTests.java index acf37e86..9f317079 100644 --- a/spring-graphql/src/test/java/org/springframework/graphql/server/WebGraphQlHandlerTests.java +++ b/spring-graphql/src/test/java/org/springframework/graphql/server/WebGraphQlHandlerTests.java @@ -46,7 +46,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class WebGraphQlHandlerTests { private static final WebGraphQlRequest webInput = new WebGraphQlRequest( - URI.create("https://abc.org"), new HttpHeaders(), null, Collections.emptyMap(), + URI.create("https://abc.org"), new HttpHeaders(), null, null, Collections.emptyMap(), new DefaultGraphQlRequest("{ greeting }"), "1", null); diff --git a/spring-graphql/src/test/java/org/springframework/graphql/server/WebGraphQlInterceptorTests.java b/spring-graphql/src/test/java/org/springframework/graphql/server/WebGraphQlInterceptorTests.java index 8909ddbd..6d007dbb 100644 --- a/spring-graphql/src/test/java/org/springframework/graphql/server/WebGraphQlInterceptorTests.java +++ b/spring-graphql/src/test/java/org/springframework/graphql/server/WebGraphQlInterceptorTests.java @@ -41,7 +41,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class WebGraphQlInterceptorTests { private static final WebGraphQlRequest webRequest = new WebGraphQlRequest( - URI.create("http://abc.org"), new HttpHeaders(), null, Collections.emptyMap(), + URI.create("http://abc.org"), new HttpHeaders(), null, null, Collections.emptyMap(), new DefaultGraphQlRequest("{ notUsed }"), "1", null); @Test