Skip to content

Commit

Permalink
Fix bug in SimpleMethodMetadataReadingVisitor.Source.toString()
Browse files Browse the repository at this point in the history
Prior to this commit, the toString() implementation did not separate
method argument types with a comma or any form of separator, leading
to results such as:

    org.example.MyClass.myMethod(java.lang.Stringjava.lang.Integer)

instead of:

    org.example.MyClass.myMethod(java.lang.String,java.lang.Integer)

Closes spring-projectsgh-27095
  • Loading branch information
sbrannen authored and lxbzmy committed Mar 26, 2022
1 parent 02ad8e8 commit 9e8c0ce
Showing 1 changed file with 10 additions and 6 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -32,6 +32,7 @@
* ASM method visitor that creates {@link SimpleMethodMetadata}.
*
* @author Phillip Webb
* @author Sam Brannen
* @since 5.2
*/
final class SimpleMethodMetadataReadingVisitor extends MethodVisitor {
Expand Down Expand Up @@ -144,14 +145,17 @@ public String toString() {
if (value == null) {
StringBuilder builder = new StringBuilder();
builder.append(this.declaringClassName);
builder.append(".");
builder.append('.');
builder.append(this.methodName);
Type[] argumentTypes = Type.getArgumentTypes(this.descriptor);
builder.append("(");
for (Type type : argumentTypes) {
builder.append(type.getClassName());
builder.append('(');
for (int i = 0; i < argumentTypes.length; i++) {
if (i != 0) {
builder.append(',');
}
builder.append(argumentTypes[i].getClassName());
}
builder.append(")");
builder.append(')');
value = builder.toString();
this.toStringValue = value;
}
Expand Down

0 comments on commit 9e8c0ce

Please sign in to comment.