Skip to content

Commit 910d278

Browse files
committed
Polishing
1 parent 2e23cf3 commit 910d278

File tree

3 files changed

+22
-21
lines changed

3 files changed

+22
-21
lines changed

spring-context/src/main/java/org/springframework/context/annotation/Configuration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@
447447
* subclass which comes with limitations such as the configuration class and
448448
* its methods not being allowed to declare {@code final}.
449449
* <p>The default is {@code true}, allowing for 'inter-bean references' via direct
450-
* method call within the configuration class as well as for external calls to
450+
* method calls within the configuration class as well as for external calls to
451451
* this configuration's {@code @Bean} methods, e.g. from another configuration class.
452452
* If this is not needed since each of this particular configuration's {@code @Bean}
453453
* methods is self-contained and designed as a plain factory method for container use,

spring-jdbc/src/main/java/org/springframework/jdbc/datasource/DataSourceTransactionManager.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2020 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.
@@ -138,6 +138,7 @@ public DataSourceTransactionManager(DataSource dataSource) {
138138
afterPropertiesSet();
139139
}
140140

141+
141142
/**
142143
* Set the JDBC DataSource that this instance should manage transactions for.
143144
* <p>This will typically be a locally defined DataSource, for example an

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

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ class DefaultServerRequest implements ServerRequest {
8686
private final Map<String, Object> attributes;
8787

8888

89-
public DefaultServerRequest(HttpServletRequest servletRequest,
90-
List<HttpMessageConverter<?>> messageConverters) {
89+
public DefaultServerRequest(HttpServletRequest servletRequest, List<HttpMessageConverter<?>> messageConverters) {
9190
this.serverHttpRequest = new ServletServerHttpRequest(servletRequest);
9291
this.messageConverters = Collections.unmodifiableList(new ArrayList<>(messageConverters));
9392
this.allSupportedMediaTypes = allSupportedMediaTypes(messageConverters);
@@ -104,6 +103,7 @@ private static List<MediaType> allSupportedMediaTypes(List<HttpMessageConverter<
104103
.collect(Collectors.toList());
105104
}
106105

106+
107107
@Override
108108
public String methodName() {
109109
return servletRequest().getMethod();
@@ -187,11 +187,8 @@ static Class<?> bodyClass(Type type) {
187187
}
188188

189189
@SuppressWarnings("unchecked")
190-
private <T> T bodyInternal(Type bodyType, Class<?> bodyClass)
191-
throws ServletException, IOException {
192-
193-
MediaType contentType =
194-
this.headers.contentType().orElse(MediaType.APPLICATION_OCTET_STREAM);
190+
private <T> T bodyInternal(Type bodyType, Class<?> bodyClass) throws ServletException, IOException {
191+
MediaType contentType = this.headers.contentType().orElse(MediaType.APPLICATION_OCTET_STREAM);
195192

196193
for (HttpMessageConverter<?> messageConverter : this.messageConverters) {
197194
if (messageConverter instanceof GenericHttpMessageConverter) {
@@ -232,10 +229,10 @@ public MultiValueMap<String, String> params() {
232229
}
233230

234231
@Override
232+
@SuppressWarnings("unchecked")
235233
public Map<String, String> pathVariables() {
236-
@SuppressWarnings("unchecked")
237-
Map<String, String> pathVariables = (Map<String, String>) servletRequest()
238-
.getAttribute(RouterFunctions.URI_TEMPLATE_VARIABLES_ATTRIBUTE);
234+
Map<String, String> pathVariables = (Map<String, String>)
235+
servletRequest().getAttribute(RouterFunctions.URI_TEMPLATE_VARIABLES_ATTRIBUTE);
239236
if (pathVariables != null) {
240237
return pathVariables;
241238
}
@@ -254,8 +251,9 @@ public Optional<Principal> principal() {
254251
return Optional.ofNullable(this.serverHttpRequest.getPrincipal());
255252
}
256253

257-
static Optional<ServerResponse> checkNotModified(HttpServletRequest servletRequest, @Nullable Instant lastModified,
258-
@Nullable String etag) {
254+
255+
static Optional<ServerResponse> checkNotModified(
256+
HttpServletRequest servletRequest, @Nullable Instant lastModified, @Nullable String etag) {
259257

260258
long lastModifiedTimestamp = -1;
261259
if (lastModified != null && lastModified.isAfter(Instant.EPOCH)) {
@@ -274,14 +272,14 @@ static Optional<ServerResponse> checkNotModified(HttpServletRequest servletReque
274272
}
275273
}
276274

275+
277276
/**
278277
* Default implementation of {@link Headers}.
279278
*/
280279
static class DefaultRequestHeaders implements Headers {
281280

282281
private final HttpHeaders delegate;
283282

284-
285283
public DefaultRequestHeaders(HttpHeaders delegate) {
286284
this.delegate = delegate;
287285
}
@@ -339,11 +337,11 @@ public String toString() {
339337
}
340338
}
341339

340+
342341
private static final class ServletParametersMap extends AbstractMap<String, List<String>> {
343342

344343
private final HttpServletRequest servletRequest;
345344

346-
347345
private ServletParametersMap(HttpServletRequest servletRequest) {
348346
this.servletRequest = servletRequest;
349347
}
@@ -389,7 +387,6 @@ public List<String> remove(Object key) {
389387
public void clear() {
390388
throw new UnsupportedOperationException();
391389
}
392-
393390
}
394391

395392

@@ -443,17 +440,15 @@ public Object remove(Object key) {
443440
this.servletRequest.removeAttribute(name);
444441
return value;
445442
}
446-
447-
448443
}
449444

445+
450446
/**
451447
* Simple implementation of {@link HttpServletResponse} used by
452448
* {@link #checkNotModified(HttpServletRequest, Instant, String)} to record status and headers set by
453449
* {@link ServletWebRequest#checkNotModified(String, long)}. Throws an {@code UnsupportedOperationException}
454450
* for other methods.
455451
*/
456-
@SuppressWarnings("deprecation")
457452
private static final class CheckNotModifiedResponse implements HttpServletResponse {
458453

459454
private final HttpHeaders headers = new HttpHeaders();
@@ -486,6 +481,7 @@ public void setStatus(int sc) {
486481
}
487482

488483
@Override
484+
@Deprecated
489485
public void setStatus(int sc, String sm) {
490486
this.status = sc;
491487
}
@@ -496,14 +492,15 @@ public int getStatus() {
496492
}
497493

498494
@Override
495+
@Nullable
499496
public String getHeader(String name) {
500497
return this.headers.getFirst(name);
501498
}
502499

503500
@Override
504501
public Collection<String> getHeaders(String name) {
505502
List<String> result = this.headers.get(name);
506-
return result != null ? result : Collections.emptyList();
503+
return (result != null ? result : Collections.emptyList());
507504
}
508505

509506
@Override
@@ -513,6 +510,7 @@ public Collection<String> getHeaderNames() {
513510

514511

515512
// Unsupported
513+
516514
@Override
517515
public void addCookie(Cookie cookie) {
518516
throw new UnsupportedOperationException();
@@ -529,11 +527,13 @@ public String encodeRedirectURL(String url) {
529527
}
530528

531529
@Override
530+
@Deprecated
532531
public String encodeUrl(String url) {
533532
throw new UnsupportedOperationException();
534533
}
535534

536535
@Override
536+
@Deprecated
537537
public String encodeRedirectUrl(String url) {
538538
throw new UnsupportedOperationException();
539539
}

0 commit comments

Comments
 (0)