Skip to content

Commit c4622db

Browse files
committed
Polishing
1 parent 9a36027 commit c4622db

File tree

17 files changed

+40
-52
lines changed

17 files changed

+40
-52
lines changed

spring-beans/src/main/java/org/springframework/beans/factory/config/DependencyDescriptor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ public boolean equals(Object other) {
430430

431431
@Override
432432
public int hashCode() {
433-
return 31 * super.hashCode() + ObjectUtils.nullSafeHashCode(this.containingClass);
433+
return (31 * super.hashCode() + ObjectUtils.nullSafeHashCode(this.containingClass));
434434
}
435435

436436

spring-context/src/main/java/org/springframework/validation/ObjectError.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2019 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.
@@ -144,7 +144,7 @@ public boolean equals(@Nullable Object other) {
144144

145145
@Override
146146
public int hashCode() {
147-
return super.hashCode() * 29 + getObjectName().hashCode();
147+
return (29 * super.hashCode() + getObjectName().hashCode());
148148
}
149149

150150
@Override

spring-jms/src/main/java/org/springframework/jms/connection/CachingConnectionFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ public boolean equals(Object other) {
591591

592592
@Override
593593
public int hashCode() {
594-
return 31 * super.hashCode() + ObjectUtils.nullSafeHashCode(this.selector);
594+
return (31 * super.hashCode() + ObjectUtils.nullSafeHashCode(this.selector));
595595
}
596596

597597
@Override

spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/HandlerMethodArgumentResolverComposite.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2019 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.
@@ -110,9 +110,8 @@ public boolean supportsParameter(MethodParameter parameter) {
110110
public Object resolveArgument(MethodParameter parameter, Message<?> message) throws Exception {
111111
HandlerMethodArgumentResolver resolver = getArgumentResolver(parameter);
112112
if (resolver == null) {
113-
throw new IllegalStateException(
114-
"Unsupported parameter type [" + parameter.getParameterType().getName() + "]." +
115-
" supportsParameter should be called first.");
113+
throw new IllegalArgumentException("Unsupported parameter type [" +
114+
parameter.getParameterType().getName() + "]. supportsParameter should be called first.");
116115
}
117116
return resolver.resolveArgument(parameter, message);
118117
}

spring-test/src/main/java/org/springframework/test/context/web/WebMergedContextConfiguration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2019 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.
@@ -178,7 +178,7 @@ public boolean equals(@Nullable Object other) {
178178
*/
179179
@Override
180180
public int hashCode() {
181-
return super.hashCode() * 31 + this.resourceBasePath.hashCode();
181+
return (31 * super.hashCode() + this.resourceBasePath.hashCode());
182182
}
183183

184184
/**

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2019 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.
@@ -447,6 +447,7 @@ public Series series() {
447447
* Whether this status code is in the HTTP series
448448
* {@link org.springframework.http.HttpStatus.Series#INFORMATIONAL}.
449449
* This is a shortcut for checking the value of {@link #series()}.
450+
* @since 4.0
450451
* @see #series()
451452
*/
452453
public boolean is1xxInformational() {
@@ -457,6 +458,7 @@ public boolean is1xxInformational() {
457458
* Whether this status code is in the HTTP series
458459
* {@link org.springframework.http.HttpStatus.Series#SUCCESSFUL}.
459460
* This is a shortcut for checking the value of {@link #series()}.
461+
* @since 4.0
460462
* @see #series()
461463
*/
462464
public boolean is2xxSuccessful() {
@@ -467,6 +469,7 @@ public boolean is2xxSuccessful() {
467469
* Whether this status code is in the HTTP series
468470
* {@link org.springframework.http.HttpStatus.Series#REDIRECTION}.
469471
* This is a shortcut for checking the value of {@link #series()}.
472+
* @since 4.0
470473
* @see #series()
471474
*/
472475
public boolean is3xxRedirection() {
@@ -477,6 +480,7 @@ public boolean is3xxRedirection() {
477480
* Whether this status code is in the HTTP series
478481
* {@link org.springframework.http.HttpStatus.Series#CLIENT_ERROR}.
479482
* This is a shortcut for checking the value of {@link #series()}.
483+
* @since 4.0
480484
* @see #series()
481485
*/
482486
public boolean is4xxClientError() {
@@ -487,6 +491,7 @@ public boolean is4xxClientError() {
487491
* Whether this status code is in the HTTP series
488492
* {@link org.springframework.http.HttpStatus.Series#SERVER_ERROR}.
489493
* This is a shortcut for checking the value of {@link #series()}.
494+
* @since 4.0
490495
* @see #series()
491496
*/
492497
public boolean is5xxServerError() {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2019 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.
@@ -169,7 +169,7 @@ public boolean equals(@Nullable Object other) {
169169

170170
@Override
171171
public int hashCode() {
172-
return (super.hashCode() * 29 + ObjectUtils.nullSafeHashCode(this.status));
172+
return (29 * super.hashCode() + ObjectUtils.nullSafeHashCode(this.status));
173173
}
174174

175175
@Override

spring-web/src/main/java/org/springframework/http/server/reactive/AbstractServerHttpResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public boolean setStatusCode(@Nullable HttpStatus status) {
109109
@Override
110110
@Nullable
111111
public HttpStatus getStatusCode() {
112-
return this.statusCode != null ? HttpStatus.resolve(this.statusCode) : null;
112+
return (this.statusCode != null ? HttpStatus.resolve(this.statusCode) : null);
113113
}
114114

115115
/**

spring-web/src/main/java/org/springframework/http/server/reactive/ReactorServerHttpResponse.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2019 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.
@@ -19,7 +19,6 @@
1919
import java.nio.file.Path;
2020

2121
import io.netty.buffer.ByteBuf;
22-
import io.netty.handler.codec.http.HttpResponseStatus;
2322
import io.netty.handler.codec.http.cookie.Cookie;
2423
import io.netty.handler.codec.http.cookie.DefaultCookie;
2524
import org.reactivestreams.Publisher;
@@ -62,14 +61,9 @@ public <T> T getNativeResponse() {
6261
}
6362

6463
@Override
65-
@SuppressWarnings("ConstantConditions")
6664
public HttpStatus getStatusCode() {
6765
HttpStatus httpStatus = super.getStatusCode();
68-
if (httpStatus == null) {
69-
HttpResponseStatus status = this.response.status();
70-
httpStatus = status != null ? HttpStatus.resolve(status.code()) : null;
71-
}
72-
return httpStatus;
66+
return (httpStatus != null ? httpStatus : HttpStatus.resolve(this.response.status().code()));
7367
}
7468

7569

spring-web/src/main/java/org/springframework/http/server/reactive/ServletServerHttpResponse.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2019 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.
@@ -100,7 +100,7 @@ public <T> T getNativeResponse() {
100100
@Override
101101
public HttpStatus getStatusCode() {
102102
HttpStatus httpStatus = super.getStatusCode();
103-
return httpStatus != null ? httpStatus : HttpStatus.resolve(this.response.getStatus());
103+
return (httpStatus != null ? httpStatus : HttpStatus.resolve(this.response.getStatus()));
104104
}
105105

106106
@Override

0 commit comments

Comments
 (0)