Skip to content

Commit 8ad5299

Browse files
committed
Polishing
1 parent 6f8a524 commit 8ad5299

File tree

7 files changed

+22
-46
lines changed

7 files changed

+22
-46
lines changed

spring-aop/src/main/java/org/springframework/aop/support/MethodMatchers.java

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,7 @@ public boolean equals(Object other) {
157157

158158
@Override
159159
public int hashCode() {
160-
int hashCode = 17;
161-
hashCode = 37 * hashCode + this.mm1.hashCode();
162-
hashCode = 37 * hashCode + this.mm2.hashCode();
163-
return hashCode;
160+
return 37 * this.mm1.hashCode() + this.mm2.hashCode();
164161
}
165162
}
166163

@@ -192,14 +189,6 @@ protected boolean matchesClass2(@Nullable Class<?> targetClass) {
192189
return (targetClass != null && this.cf2.matches(targetClass));
193190
}
194191

195-
@Override
196-
public int hashCode() {
197-
int hashCode = 17;
198-
hashCode = 37 * hashCode + this.cf1.hashCode();
199-
hashCode = 37 * hashCode + this.cf2.hashCode();
200-
return hashCode;
201-
}
202-
203192
@Override
204193
public boolean equals(Object other) {
205194
if (this == other) {
@@ -217,6 +206,14 @@ public boolean equals(Object other) {
217206
}
218207
return (this.cf1.equals(otherCf1) && this.cf2.equals(otherCf2));
219208
}
209+
210+
@Override
211+
public int hashCode() {
212+
int hashCode = super.hashCode();
213+
hashCode = 37 * hashCode + this.cf1.hashCode();
214+
hashCode = 37 * hashCode + this.cf2.hashCode();
215+
return hashCode;
216+
}
220217
}
221218

222219

@@ -279,10 +276,7 @@ public boolean equals(Object other) {
279276

280277
@Override
281278
public int hashCode() {
282-
int hashCode = 17;
283-
hashCode = 37 * hashCode + this.mm1.hashCode();
284-
hashCode = 37 * hashCode + this.mm2.hashCode();
285-
return hashCode;
279+
return 37 * this.mm1.hashCode() + this.mm2.hashCode();
286280
}
287281
}
288282

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

Lines changed: 2 additions & 7 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-2018 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.
@@ -390,12 +390,7 @@ public boolean equals(Object other) {
390390

391391
@Override
392392
public int hashCode() {
393-
final int prime = 31;
394-
int result = ObjectUtils.nullSafeHashCode(this.containingClass);
395-
result = prime * result + Boolean.hashCode(this.eager);
396-
result = prime * result + this.nestingLevel;
397-
result = prime * result + Boolean.hashCode(this.required);
398-
return result;
393+
return 31 * super.hashCode() + ObjectUtils.nullSafeHashCode(this.containingClass);
399394
}
400395

401396

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
* @see org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor
5959
* @see org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor
6060
*/
61-
public final class AnnotationConfigUtils {
61+
public abstract class AnnotationConfigUtils {
6262

6363
/**
6464
* The bean name of the internally managed Configuration annotation processor.
@@ -126,10 +126,6 @@ public final class AnnotationConfigUtils {
126126
ClassUtils.isPresent(PERSISTENCE_ANNOTATION_PROCESSOR_CLASS_NAME, AnnotationConfigUtils.class.getClassLoader());
127127

128128

129-
private AnnotationConfigUtils() {
130-
}
131-
132-
133129
/**
134130
* Register all relevant annotation post processors in the given registry.
135131
* @param registry the registry to operate on

spring-expression/src/main/java/org/springframework/expression/spel/CodeFlow.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -962,7 +962,7 @@ public static int arrayCodeFor(String arraytype) {
962962
}
963963

964964
/**
965-
* Returns if the supplied array type has a core component reference type.
965+
* Return if the supplied array type has a core component reference type.
966966
*/
967967
public static boolean isReferenceTypeArray(String arraytype) {
968968
int length = arraytype.length();
@@ -1061,5 +1061,4 @@ public interface ClinitAdder {
10611061
void generateCode(MethodVisitor mv, CodeFlow codeflow);
10621062
}
10631063

1064-
10651064
}

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -582,12 +582,7 @@ public boolean equals(Object other) {
582582

583583
@Override
584584
public int hashCode() {
585-
int prime = 31;
586-
int result = ObjectUtils.nullSafeHashCode(this.selector);
587-
result = prime * result + ObjectUtils.nullSafeHashCode(this.noLocal);
588-
result = prime * result + ObjectUtils.nullSafeHashCode(this.subscription);
589-
result = prime * result + Boolean.hashCode(this.durable);
590-
return result;
585+
return 31 * super.hashCode() + ObjectUtils.nullSafeHashCode(this.selector);
591586
}
592587

593588
@Override

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ public final Mono<String> getForUriString(String uriString, ServerWebExchange ex
123123
String lookupPath = uriString.substring(0, queryIndex);
124124
String query = uriString.substring(queryIndex);
125125
PathContainer parsedLookupPath = PathContainer.parsePath(lookupPath);
126+
126127
return resolveResourceUrl(parsedLookupPath).map(resolvedPath ->
127128
request.getPath().contextPath().value() + resolvedPath + query);
128129
}
@@ -154,8 +155,7 @@ private Mono<String> resolveResourceUrl(PathContainer lookupPath) {
154155
List<ResourceResolver> resolvers = handler.getResourceResolvers();
155156
ResourceResolverChain chain = new DefaultResourceResolverChain(resolvers);
156157
return chain.resolveUrlPath(path.value(), handler.getLocations())
157-
.map(resolvedPath -> mapping.value() + resolvedPath);
158-
158+
.map(resolvedPath -> mapping.value() + resolvedPath);
159159
})
160160
.orElseGet(() ->{
161161
if (logger.isTraceEnabled()) {

spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestPartMethodArgumentResolver.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,23 +51,20 @@
5151
*/
5252
public class RequestPartMethodArgumentResolver extends AbstractMessageReaderArgumentResolver {
5353

54-
public RequestPartMethodArgumentResolver(List<HttpMessageReader<?>> readers,
55-
ReactiveAdapterRegistry registry) {
56-
54+
public RequestPartMethodArgumentResolver(List<HttpMessageReader<?>> readers, ReactiveAdapterRegistry registry) {
5755
super(readers, registry);
5856
}
5957

6058

6159
@Override
6260
public boolean supportsParameter(MethodParameter parameter) {
63-
return parameter.hasParameterAnnotation(RequestPart.class) ||
64-
checkParameterType(parameter, Part.class::isAssignableFrom);
61+
return (parameter.hasParameterAnnotation(RequestPart.class) ||
62+
checkParameterType(parameter, Part.class::isAssignableFrom));
6563
}
6664

67-
6865
@Override
69-
public Mono<Object> resolveArgument(MethodParameter parameter, BindingContext bindingContext,
70-
ServerWebExchange exchange) {
66+
public Mono<Object> resolveArgument(
67+
MethodParameter parameter, BindingContext bindingContext, ServerWebExchange exchange) {
7168

7269
RequestPart requestPart = parameter.getParameterAnnotation(RequestPart.class);
7370
boolean isRequired = (requestPart == null || requestPart.required());

0 commit comments

Comments
 (0)