Skip to content

Commit 7e8f6ec

Browse files
committed
Create toShortSignature() in Method.java
1 parent 77befe2 commit 7e8f6ec

File tree

1 file changed

+12
-0
lines changed
  • src/classes/modules/java.base/java/lang/reflect

1 file changed

+12
-0
lines changed

src/classes/modules/java.base/java/lang/reflect/Method.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,18 @@ public boolean isSynthetic (){
6363
@Override
6464
public native String toString();
6565

66+
67+
String toShortSignature(){
68+
StringBuilder sb = new StringBuilder();
69+
sb.append(getName());
70+
Class<?>[] ps = getParameterTypes();
71+
for (int i=0; i<ps.length; i++){
72+
Class<?> parameter = ps[i];
73+
sb.append(parameter.getTypeName());
74+
}
75+
return sb.toString();
76+
}
77+
6678
// for Annotations - return the default value of the annotation member
6779
// represented by this method
6880
public native Object getDefaultValue();

0 commit comments

Comments
 (0)