Skip to content

Commit 51b8ba3

Browse files
committed
Polishing
1 parent abc2269 commit 51b8ba3

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

spring-beans/src/main/java/org/springframework/beans/support/ArgumentConvertingMethodInvoker.java

Lines changed: 4 additions & 3 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-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.
@@ -146,8 +146,9 @@ protected Method doFindMatchingMethod(Object[] arguments) {
146146
for (Method candidate : candidates) {
147147
if (candidate.getName().equals(targetMethod)) {
148148
// Check if the inspected method has the correct number of parameters.
149-
Class<?>[] paramTypes = candidate.getParameterTypes();
150-
if (paramTypes.length == argCount) {
149+
int parameterCount = candidate.getParameterCount();
150+
if (parameterCount == argCount) {
151+
Class<?>[] paramTypes = candidate.getParameterTypes();
151152
Object[] convertedArguments = new Object[argCount];
152153
boolean match = true;
153154
for (int j = 0; j < argCount && match; j++) {

spring-core/src/main/java/org/springframework/core/GenericTypeResolver.java

Lines changed: 3 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-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.
@@ -169,11 +169,12 @@ else if (genericType instanceof ParameterizedType) {
169169
ParameterizedType parameterizedType = (ParameterizedType) genericType;
170170
Class<?>[] generics = new Class<?>[parameterizedType.getActualTypeArguments().length];
171171
Type[] typeArguments = parameterizedType.getActualTypeArguments();
172+
ResolvableType contextType = ResolvableType.forClass(contextClass);
172173
for (int i = 0; i < typeArguments.length; i++) {
173174
Type typeArgument = typeArguments[i];
174175
if (typeArgument instanceof TypeVariable) {
175176
ResolvableType resolvedTypeArgument = resolveVariable(
176-
(TypeVariable<?>) typeArgument, ResolvableType.forClass(contextClass));
177+
(TypeVariable<?>) typeArgument, contextType);
177178
if (resolvedTypeArgument != ResolvableType.NONE) {
178179
generics[i] = resolvedTypeArgument.resolve();
179180
}

spring-core/src/main/java/org/springframework/core/type/classreading/MethodMetadataReadingVisitor.java

Lines changed: 3 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-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.
@@ -149,9 +149,10 @@ public MultiValueMap<String, Object> getAllAnnotationAttributes(String annotatio
149149
MultiValueMap<String, Object> allAttributes = new LinkedMultiValueMap<>();
150150
List<AnnotationAttributes> attributesList = this.attributesMap.get(annotationName);
151151
if (attributesList != null) {
152+
String annotatedElement = "method '" + getMethodName() + '\'';
152153
for (AnnotationAttributes annotationAttributes : attributesList) {
153154
AnnotationAttributes convertedAttributes = AnnotationReadingVisitorUtils.convertClassValues(
154-
"method '" + getMethodName() + "'", this.classLoader, annotationAttributes, classValuesAsString);
155+
annotatedElement, this.classLoader, annotationAttributes, classValuesAsString);
155156
convertedAttributes.forEach(allAttributes::add);
156157
}
157158
}

spring-jcl/src/main/java/org/apache/commons/logging/LogAdapter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -608,8 +608,8 @@ private void log(java.util.logging.Level level, Object message, Throwable except
608608
else {
609609
rec = new LocationResolvingLogRecord(level, String.valueOf(message));
610610
rec.setLoggerName(this.name);
611-
rec.setResourceBundleName(logger.getResourceBundleName());
612-
rec.setResourceBundle(logger.getResourceBundle());
611+
rec.setResourceBundleName(this.logger.getResourceBundleName());
612+
rec.setResourceBundle(this.logger.getResourceBundle());
613613
rec.setThrown(exception);
614614
}
615615
logger.log(rec);

0 commit comments

Comments
 (0)