Skip to content

Commit edf7f3c

Browse files
committed
Polishing
1 parent 58c64cb commit edf7f3c

File tree

15 files changed

+44
-46
lines changed

15 files changed

+44
-46
lines changed

spring-context/src/test/java/org/springframework/scheduling/concurrent/AbstractSchedulingTaskExecutorTests.java

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ void submitRunnableWithGetAfterShutdown() throws Exception {
125125
}
126126

127127
@Test
128-
@SuppressWarnings({ "deprecation", "removal" })
128+
@SuppressWarnings("removal")
129129
void submitListenableRunnable() {
130130
TestTask task = new TestTask(this.testName, 1);
131131
// Act
@@ -156,7 +156,7 @@ void submitCompletableRunnable() {
156156
}
157157

158158
@Test
159-
@SuppressWarnings({ "deprecation", "removal" })
159+
@SuppressWarnings("removal")
160160
void submitFailingListenableRunnable() {
161161
TestTask task = new TestTask(this.testName, 0);
162162
org.springframework.util.concurrent.ListenableFuture<?> future = executor.submitListenable(task);
@@ -185,7 +185,7 @@ void submitFailingCompletableRunnable() {
185185
}
186186

187187
@Test
188-
@SuppressWarnings({ "deprecation", "removal" })
188+
@SuppressWarnings("removal")
189189
void submitListenableRunnableWithGetAfterShutdown() throws Exception {
190190
org.springframework.util.concurrent.ListenableFuture<?> future1 = executor.submitListenable(new TestTask(this.testName, -1));
191191
org.springframework.util.concurrent.ListenableFuture<?> future2 = executor.submitListenable(new TestTask(this.testName, -1));
@@ -209,18 +209,10 @@ void submitCompletableRunnableWithGetAfterShutdown() throws Exception {
209209
CompletableFuture<?> future1 = executor.submitCompletable(new TestTask(this.testName, -1));
210210
CompletableFuture<?> future2 = executor.submitCompletable(new TestTask(this.testName, -1));
211211
shutdownExecutor();
212-
213-
try {
212+
assertThatExceptionOfType(TimeoutException.class).isThrownBy(() -> {
214213
future1.get(1000, TimeUnit.MILLISECONDS);
215-
}
216-
catch (Exception ex) {
217-
// ignore
218-
}
219-
Awaitility.await()
220-
.atMost(5, TimeUnit.SECONDS)
221-
.pollInterval(10, TimeUnit.MILLISECONDS)
222-
.untilAsserted(() -> assertThatExceptionOfType(TimeoutException.class)
223-
.isThrownBy(() -> future2.get(1000, TimeUnit.MILLISECONDS)));
214+
future2.get(1000, TimeUnit.MILLISECONDS);
215+
});
224216
}
225217

226218
@Test
@@ -260,7 +252,7 @@ void submitCallableWithGetAfterShutdown() throws Exception {
260252
}
261253

262254
@Test
263-
@SuppressWarnings({ "deprecation", "removal" })
255+
@SuppressWarnings("removal")
264256
void submitListenableCallable() {
265257
TestCallable task = new TestCallable(this.testName, 1);
266258
// Act
@@ -275,7 +267,7 @@ void submitListenableCallable() {
275267
}
276268

277269
@Test
278-
@SuppressWarnings({ "deprecation", "removal" })
270+
@SuppressWarnings("removal")
279271
void submitFailingListenableCallable() {
280272
TestCallable task = new TestCallable(this.testName, 0);
281273
// Act
@@ -291,7 +283,7 @@ void submitFailingListenableCallable() {
291283
}
292284

293285
@Test
294-
@SuppressWarnings({ "deprecation", "removal" })
286+
@SuppressWarnings("removal")
295287
void submitListenableCallableWithGetAfterShutdown() throws Exception {
296288
org.springframework.util.concurrent.ListenableFuture<?> future1 = executor.submitListenable(new TestCallable(this.testName, -1));
297289
org.springframework.util.concurrent.ListenableFuture<?> future2 = executor.submitListenable(new TestCallable(this.testName, -1));

spring-test/src/main/java/org/springframework/test/context/jdbc/SqlScriptsTestExecutionListener.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,10 @@ public void afterTestMethod(TestContext testContext) {
182182
@Override
183183
public void processAheadOfTime(RuntimeHints runtimeHints, Class<?> testClass, ClassLoader classLoader) {
184184
getSqlAnnotationsFor(testClass).forEach(sql ->
185-
registerClasspathResources(getScripts(sql, testClass, null, true), runtimeHints, classLoader));
185+
registerClasspathResources(getScripts(sql, testClass, null, true), runtimeHints, classLoader));
186186
getSqlMethods(testClass).forEach(testMethod ->
187-
getSqlAnnotationsFor(testMethod).forEach(sql ->
188-
registerClasspathResources(getScripts(sql, testClass, testMethod, false), runtimeHints, classLoader)));
187+
getSqlAnnotationsFor(testMethod).forEach(sql ->
188+
registerClasspathResources(getScripts(sql, testClass, testMethod, false), runtimeHints, classLoader)));
189189
}
190190

191191
/**

spring-web/src/main/java/org/springframework/http/MediaType.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,7 @@ public static String toString(Collection<MediaType> mediaTypes) {
871871
* <blockquote>audio/basic == text/html</blockquote>
872872
* <blockquote>audio/basic == audio/wave</blockquote>
873873
* @param mediaTypes the list of media types to be sorted
874-
* @deprecated As of 6.0, in favor of {@link MimeTypeUtils#sortBySpecificity(List)}
874+
* @deprecated as of 6.0, in favor of {@link MimeTypeUtils#sortBySpecificity(List)}
875875
*/
876876
@Deprecated(since = "6.0", forRemoval = true)
877877
public static void sortBySpecificity(List<MediaType> mediaTypes) {
@@ -900,7 +900,7 @@ public static void sortBySpecificity(List<MediaType> mediaTypes) {
900900
* </ol>
901901
* @param mediaTypes the list of media types to be sorted
902902
* @see #getQualityValue()
903-
* @deprecated As of 6.0, with no direct replacement
903+
* @deprecated as of 6.0, with no direct replacement
904904
*/
905905
@Deprecated(since = "6.0", forRemoval = true)
906906
public static void sortByQualityValue(List<MediaType> mediaTypes) {
@@ -913,9 +913,9 @@ public static void sortByQualityValue(List<MediaType> mediaTypes) {
913913
/**
914914
* Sorts the given list of {@code MediaType} objects by specificity as the
915915
* primary criteria and quality value the secondary.
916-
* @deprecated As of 6.0, in favor of {@link MimeTypeUtils#sortBySpecificity(List)}
916+
* @deprecated as of 6.0, in favor of {@link MimeTypeUtils#sortBySpecificity(List)}
917917
*/
918-
@Deprecated(since = "6.0")
918+
@Deprecated(since = "6.0", forRemoval = true)
919919
public static void sortBySpecificityAndQuality(List<MediaType> mediaTypes) {
920920
Assert.notNull(mediaTypes, "'mediaTypes' must not be null");
921921
if (mediaTypes.size() > 1) {
@@ -926,7 +926,7 @@ public static void sortBySpecificityAndQuality(List<MediaType> mediaTypes) {
926926

927927
/**
928928
* Comparator used by {@link #sortByQualityValue(List)}.
929-
* @deprecated As of 6.0, with no direct replacement
929+
* @deprecated as of 6.0, with no direct replacement
930930
*/
931931
@Deprecated(since = "6.0", forRemoval = true)
932932
public static final Comparator<MediaType> QUALITY_VALUE_COMPARATOR = (mediaType1, mediaType2) -> {
@@ -966,7 +966,7 @@ else if (!mediaType1.getSubtype().equals(mediaType2.getSubtype())) { // audio/b
966966

967967
/**
968968
* Comparator used by {@link #sortBySpecificity(List)}.
969-
* @deprecated As of 6.0, with no direct replacement
969+
* @deprecated as of 6.0, with no direct replacement
970970
*/
971971
@Deprecated(since = "6.0", forRemoval = true)
972972
@SuppressWarnings("removal")

spring-webflux/spring-webflux.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ dependencies {
2727
optional("org.eclipse.jetty.ee10.websocket:jetty-ee10-websocket-jetty-server") {
2828
exclude group: "jakarta.servlet", module: "jakarta.servlet-api"
2929
}
30-
optional("org.eclipse.jetty.websocket:jetty-websocket-jetty-server")
3130
optional("org.eclipse.jetty.websocket:jetty-websocket-jetty-client")
31+
optional("org.eclipse.jetty.websocket:jetty-websocket-jetty-server")
3232
optional("org.freemarker:freemarker")
3333
optional("org.jetbrains.kotlin:kotlin-reflect")
3434
optional("org.jetbrains.kotlin:kotlin-stdlib")

spring-webflux/src/main/java/org/springframework/web/reactive/resource/LiteWebJarsResourceResolver.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public class LiteWebJarsResourceResolver extends AbstractResourceResolver {
4949

5050
private final WebJarVersionLocator webJarVersionLocator;
5151

52+
5253
/**
5354
* Create a {@code LiteWebJarsResourceResolver} with a default {@code WebJarVersionLocator} instance.
5455
*/
@@ -64,6 +65,7 @@ public LiteWebJarsResourceResolver(WebJarVersionLocator webJarVersionLocator) {
6465
this.webJarVersionLocator = webJarVersionLocator;
6566
}
6667

68+
6769
@Override
6870
protected Mono<Resource> resolveResourceInternal(@Nullable ServerWebExchange exchange,
6971
String requestPath, List<? extends Resource> locations, ResourceResolverChain chain) {

spring-webmvc/src/main/java/org/springframework/web/servlet/function/CompletedAsyncServerResponse.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ final class CompletedAsyncServerResponse implements AsyncServerResponse {
4646
this.serverResponse = serverResponse;
4747
}
4848

49+
4950
@Override
5051
public ServerResponse block() {
5152
return this.serverResponse;
@@ -73,11 +74,12 @@ public MultiValueMap<String, Cookie> cookies() {
7374
return this.serverResponse.cookies();
7475
}
7576

76-
@Nullable
7777
@Override
78+
@Nullable
7879
public ModelAndView writeTo(HttpServletRequest request, HttpServletResponse response, Context context)
7980
throws ServletException, IOException {
8081

8182
return this.serverResponse.writeTo(request, response, context);
8283
}
84+
8385
}

spring-webmvc/src/main/java/org/springframework/web/servlet/function/DefaultAsyncServerResponse.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ final class DefaultAsyncServerResponse extends ErrorHandlingServerResponse imple
6363
this.timeout = timeout;
6464
}
6565

66+
6667
@Override
6768
public ServerResponse block() {
6869
try {
@@ -110,8 +111,8 @@ private <R> R delegate(Function<ServerResponse, R> function) {
110111
}
111112
}
112113

113-
@Nullable
114114
@Override
115+
@Nullable
115116
public ModelAndView writeTo(HttpServletRequest request, HttpServletResponse response, Context context)
116117
throws ServletException, IOException {
117118

@@ -164,4 +165,5 @@ private DeferredResult<ServerResponse> createDeferredResult(HttpServletRequest r
164165
});
165166
return result;
166167
}
168+
167169
}

spring-webmvc/src/main/java/org/springframework/web/servlet/resource/LiteWebJarsResourceResolver.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public class LiteWebJarsResourceResolver extends AbstractResourceResolver {
4949

5050
private final WebJarVersionLocator webJarVersionLocator;
5151

52+
5253
/**
5354
* Create a {@code LiteWebJarsResourceResolver} with a default {@code WebJarVersionLocator} instance.
5455
*/
@@ -64,6 +65,7 @@ public LiteWebJarsResourceResolver(WebJarVersionLocator webJarVersionLocator) {
6465
this.webJarVersionLocator = webJarVersionLocator;
6566
}
6667

68+
6769
@Override
6870
@Nullable
6971
protected Resource resolveResourceInternal(@Nullable HttpServletRequest request, String requestPath,

spring-webmvc/src/test/java/org/springframework/web/servlet/function/DefaultServerResponseBuilderTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class DefaultServerResponseBuilderTests {
5454

5555
static final ServerResponse.Context EMPTY_CONTEXT = Collections::emptyList;
5656

57+
5758
@Test
5859
@SuppressWarnings("removal")
5960
void status() {
@@ -75,7 +76,6 @@ void from() {
7576
assertThat(result.cookies().getFirst("foo")).isEqualTo(cookie);
7677
}
7778

78-
7979
@Test
8080
void ok() {
8181
ServerResponse response = ServerResponse.ok().build();

spring-websocket/spring-websocket.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ dependencies {
1616
exclude group: "org.apache.tomcat", module: "tomcat-servlet-api"
1717
exclude group: "org.apache.tomcat", module: "tomcat-websocket-api"
1818
}
19-
optional("org.eclipse.jetty.ee10:jetty-ee10-webapp") {
20-
exclude group: "jakarta.servlet", module: "jakarta.servlet-api"
21-
}
22-
optional("org.eclipse.jetty.websocket:jetty-websocket-jetty-api")
2319
optional("org.eclipse.jetty.ee10.websocket:jetty-ee10-websocket-jakarta-server")
2420
optional("org.eclipse.jetty.ee10.websocket:jetty-ee10-websocket-jetty-server") {
2521
exclude group: "jakarta.servlet", module: "jakarta.servlet-api"
2622
}
23+
optional("org.eclipse.jetty.ee10:jetty-ee10-webapp") {
24+
exclude group: "jakarta.servlet", module: "jakarta.servlet-api"
25+
}
26+
optional("org.eclipse.jetty.websocket:jetty-websocket-jetty-api")
2727
optional("org.glassfish.tyrus:tyrus-container-servlet")
2828
testImplementation(testFixtures(project(":spring-core")))
2929
testImplementation(testFixtures(project(":spring-web")))

spring-websocket/src/main/java/org/springframework/web/socket/adapter/standard/StandardToWebSocketExtensionAdapter.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,10 @@
3434
*/
3535
public class StandardToWebSocketExtensionAdapter extends WebSocketExtension {
3636

37-
3837
public StandardToWebSocketExtensionAdapter(Extension extension) {
3938
super(extension.getName(), initParameters(extension));
4039
}
4140

42-
4341
private static Map<String, String> initParameters(Extension extension) {
4442
List<Extension.Parameter> parameters = extension.getParameters();
4543
Map<String, String> result = new LinkedCaseInsensitiveMap<>(parameters.size(), Locale.ROOT);

spring-websocket/src/main/java/org/springframework/web/socket/adapter/standard/WebSocketToStandardExtensionAdapter.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -55,6 +55,7 @@ public String getValue() {
5555
}
5656
}
5757

58+
5859
@Override
5960
public String getName() {
6061
return this.name;

spring-websocket/src/main/java/org/springframework/web/socket/messaging/WebSocketStompClient.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ public CompletableFuture<StompSession> connectAsync(String url, StompSessionHand
262262

263263
/**
264264
* An overloaded version of
265-
* {@link #connect(String, StompSessionHandler, Object...)} that also
265+
* {@link #connectAsync(String, StompSessionHandler, Object...)} that also
266266
* accepts {@link WebSocketHttpHeaders} to use for the WebSocket handshake.
267267
* @param url the url to connect to
268268
* @param handshakeHeaders the headers for the WebSocket handshake
@@ -283,7 +283,7 @@ public org.springframework.util.concurrent.ListenableFuture<StompSession> connec
283283

284284
/**
285285
* An overloaded version of
286-
* {@link #connect(String, StompSessionHandler, Object...)} that also
286+
* {@link #connectAsync(String, StompSessionHandler, Object...)} that also
287287
* accepts {@link WebSocketHttpHeaders} to use for the WebSocket handshake.
288288
* @param url the url to connect to
289289
* @param handshakeHeaders the headers for the WebSocket handshake
@@ -300,7 +300,7 @@ public CompletableFuture<StompSession> connectAsync(String url, @Nullable WebSoc
300300

301301
/**
302302
* An overloaded version of
303-
* {@link #connect(String, StompSessionHandler, Object...)} that also accepts
303+
* {@link #connectAsync(String, StompSessionHandler, Object...)} that also accepts
304304
* {@link WebSocketHttpHeaders} to use for the WebSocket handshake and
305305
* {@link StompHeaders} for the STOMP CONNECT frame.
306306
* @param url the url to connect to
@@ -323,7 +323,7 @@ public org.springframework.util.concurrent.ListenableFuture<StompSession> connec
323323

324324
/**
325325
* An overloaded version of
326-
* {@link #connect(String, StompSessionHandler, Object...)} that also accepts
326+
* {@link #connectAsync(String, StompSessionHandler, Object...)} that also accepts
327327
* {@link WebSocketHttpHeaders} to use for the WebSocket handshake and
328328
* {@link StompHeaders} for the STOMP CONNECT frame.
329329
* @param url the url to connect to
@@ -344,7 +344,7 @@ public CompletableFuture<StompSession> connectAsync(String url, @Nullable WebSoc
344344

345345
/**
346346
* An overloaded version of
347-
* {@link #connect(String, WebSocketHttpHeaders, StompSessionHandler, Object...)}
347+
* {@link #connectAsync(String, WebSocketHttpHeaders, StompSessionHandler, Object...)}
348348
* that accepts a fully prepared {@link java.net.URI}.
349349
* @param url the url to connect to
350350
* @param handshakeHeaders the headers for the WebSocket handshake
@@ -365,7 +365,7 @@ public org.springframework.util.concurrent.ListenableFuture<StompSession> connec
365365

366366
/**
367367
* An overloaded version of
368-
* {@link #connect(String, WebSocketHttpHeaders, StompSessionHandler, Object...)}
368+
* {@link #connectAsync(String, WebSocketHttpHeaders, StompSessionHandler, Object...)}
369369
* that accepts a fully prepared {@link java.net.URI}.
370370
* @param url the url to connect to
371371
* @param handshakeHeaders the headers for the WebSocket handshake

spring-websocket/src/main/java/org/springframework/web/socket/sockjs/client/DefaultTransportRequest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ private void handleFailure(@Nullable Throwable ex, boolean isTimeoutFailure) {
279279
}
280280
}
281281

282+
282283
/**
283284
* Updates the given (global) future based success or failure to connect for
284285
* the entire SockJS request regardless of which transport actually managed

spring-websocket/src/test/java/org/springframework/web/socket/sockjs/client/XhrTransportTests.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ void sendMessageError() {
8484
}
8585

8686
@Test
87-
@SuppressWarnings({"deprecation", "removal"})
8887
void connect() {
8988
HttpHeaders handshakeHeaders = new HttpHeaders();
9089
handshakeHeaders.setOrigin("foo");
@@ -96,7 +95,7 @@ void connect() {
9695

9796
TestXhrTransport transport = new TestXhrTransport();
9897
WebSocketHandler handler = mock();
99-
transport.connect(request, handler);
98+
transport.connectAsync(request, handler);
10099

101100
ArgumentCaptor<Runnable> captor = ArgumentCaptor.forClass(Runnable.class);
102101
verify(request).getSockJsUrlInfo();
@@ -127,7 +126,6 @@ private static class TestXhrTransport extends AbstractXhrTransport {
127126

128127
private XhrClientSockJsSession actualSession;
129128

130-
131129
@Override
132130
protected ResponseEntity<String> executeInfoRequestInternal(URI infoUrl, HttpHeaders headers) {
133131
return this.infoResponseToReturn;

0 commit comments

Comments
 (0)