@@ -55,7 +55,7 @@ public final class MethodUtils {
5555 /**
5656 * Represents the key to looking up a Method by reflection.
5757 */
58- private static final class MethodDescriptor {
58+ private static final class MethodKey {
5959 private final Class <?> cls ;
6060 private final String methodName ;
6161 private final Class <?>[] paramTypes ;
@@ -70,7 +70,7 @@ private static final class MethodDescriptor {
7070 * @param paramTypes the array of classes representing the parameter types.
7171 * @param exact whether the match has to be exact.
7272 */
73- public MethodDescriptor (final Class <?> cls , final String methodName , final Class <?>[] paramTypes , final boolean exact ) {
73+ public MethodKey (final Class <?> cls , final String methodName , final Class <?>[] paramTypes , final boolean exact ) {
7474 this .cls = Objects .requireNonNull (cls , "cls" );
7575 this .methodName = Objects .requireNonNull (methodName , "methodName" );
7676 this .paramTypes = paramTypes != null ? paramTypes : BeanUtils .EMPTY_CLASS_ARRAY ;
@@ -86,10 +86,10 @@ public MethodDescriptor(final Class<?> cls, final String methodName, final Class
8686 */
8787 @ Override
8888 public boolean equals (final Object obj ) {
89- if (!(obj instanceof MethodDescriptor )) {
89+ if (!(obj instanceof MethodKey )) {
9090 return false ;
9191 }
92- final MethodDescriptor md = (MethodDescriptor ) obj ;
92+ final MethodKey md = (MethodKey ) obj ;
9393
9494 return exact == md .exact && methodName .equals (md .methodName ) && cls .equals (md .cls ) && Arrays .equals (paramTypes , md .paramTypes );
9595 }
@@ -131,17 +131,17 @@ public int hashCode() {
131131 * loaders will generate non-equal MethodDescriptor objects and hence end up with different entries in the map.
132132 * </p>
133133 */
134- private static final Map <MethodDescriptor , Reference <Method >> CACHE = Collections .synchronizedMap (new WeakHashMap <>());
134+ private static final Map <MethodKey , Reference <Method >> CACHE = Collections .synchronizedMap (new WeakHashMap <>());
135135
136136 /**
137137 * Add a method to the cache.
138138 *
139- * @param md The method descriptor.
139+ * @param key The method descriptor.
140140 * @param method The method to cache.
141141 */
142- private static void cacheMethod (final MethodDescriptor md , final Method method ) {
142+ private static void cacheMethod (final MethodKey key , final Method method ) {
143143 if (CACHE_METHODS && method != null ) {
144- CACHE .put (md , new WeakReference <>(method ));
144+ CACHE .put (key , new WeakReference <>(method ));
145145 }
146146 }
147147
@@ -220,15 +220,15 @@ public static Method getAccessibleMethod(Class<?> clazz, Method method) {
220220 */
221221 public static Method getAccessibleMethod (final Class <?> clazz , final String methodName , final Class <?>... parameterTypes ) {
222222 try {
223- final MethodDescriptor md = new MethodDescriptor (clazz , methodName , parameterTypes , true );
223+ final MethodKey key = new MethodKey (clazz , methodName , parameterTypes , true );
224224 // Check the cache first
225- Method method = getCachedMethod (md );
225+ Method method = getCachedMethod (key );
226226 if (method != null ) {
227227 return method ;
228228 }
229229
230230 method = getAccessibleMethod (clazz , clazz .getMethod (methodName , parameterTypes ));
231- cacheMethod (md , method );
231+ cacheMethod (key , method );
232232 return method ;
233233 } catch (final NoSuchMethodException e ) {
234234 return null ;
@@ -331,12 +331,12 @@ private static Method getAccessibleMethodFromSuperclass(final Class<?> clazz, fi
331331 /**
332332 * Gets the method from the cache, if present.
333333 *
334- * @param md The method descriptor.
334+ * @param key The method descriptor.
335335 * @return The cached method.
336336 */
337- private static Method getCachedMethod (final MethodDescriptor md ) {
337+ private static Method getCachedMethod (final MethodKey key ) {
338338 if (CACHE_METHODS ) {
339- final Reference <Method > methodRef = CACHE .get (md );
339+ final Reference <Method > methodRef = CACHE .get (key );
340340 if (methodRef != null ) {
341341 return methodRef .get ();
342342 }
@@ -369,13 +369,13 @@ public static Method getMatchingAccessibleMethod(final Class<?> clazz, final Str
369369 if (LOG .isTraceEnabled ()) {
370370 LOG .trace ("Matching name=" + methodName + " on " + clazz );
371371 }
372- final MethodDescriptor md = new MethodDescriptor (clazz , methodName , parameterTypes , false );
372+ final MethodKey key = new MethodKey (clazz , methodName , parameterTypes , false );
373373
374374 // see if we can find the method directly
375375 // most of the time this works and it's much faster
376376 try {
377377 // Check the cache first
378- Method method = getCachedMethod (md );
378+ Method method = getCachedMethod (key );
379379 if (method != null ) {
380380 return method ;
381381 }
@@ -388,7 +388,7 @@ public static Method getMatchingAccessibleMethod(final Class<?> clazz, final Str
388388
389389 setMethodAccessible (method ); // Default access superclass workaround
390390
391- cacheMethod (md , method );
391+ cacheMethod (key , method );
392392 return method ;
393393
394394 } catch (final NoSuchMethodException e ) {
@@ -448,7 +448,7 @@ public static Method getMatchingAccessibleMethod(final Class<?> clazz, final Str
448448 }
449449 }
450450 if (bestMatch != null ) {
451- cacheMethod (md , bestMatch );
451+ cacheMethod (key , bestMatch );
452452 } else {
453453 // didn't find a match
454454 LOG .trace ("No match found." );
0 commit comments