@@ -316,31 +316,41 @@ private void readObject(ObjectInputStream ois) throws IOException, ClassNotFound
316
316
*/
317
317
static final class ProxiedInterfacesCache {
318
318
319
- Class <?>[] proxiedInterfaces ;
319
+ final Class <?>[] proxiedInterfaces ;
320
320
321
- boolean equalsDefined ;
321
+ final boolean equalsDefined ;
322
322
323
- boolean hashCodeDefined ;
323
+ final boolean hashCodeDefined ;
324
324
325
325
ProxiedInterfacesCache (AdvisedSupport config ) {
326
326
this .proxiedInterfaces = AopProxyUtils .completeProxiedInterfaces (config , true );
327
327
328
328
// Find any {@link #equals} or {@link #hashCode} method that may be defined
329
- //on the supplied set of interfaces.
329
+ // on the supplied set of interfaces.
330
+ boolean equalsDefined = false ;
331
+ boolean hashCodeDefined = false ;
330
332
for (Class <?> proxiedInterface : this .proxiedInterfaces ) {
331
333
Method [] methods = proxiedInterface .getDeclaredMethods ();
332
334
for (Method method : methods ) {
333
335
if (AopUtils .isEqualsMethod (method )) {
334
- this .equalsDefined = true ;
336
+ equalsDefined = true ;
337
+ if (hashCodeDefined ) {
338
+ break ;
339
+ }
335
340
}
336
341
if (AopUtils .isHashCodeMethod (method )) {
337
- this . hashCodeDefined = true ;
338
- }
339
- if ( this . equalsDefined && this . hashCodeDefined ) {
340
- return ;
342
+ hashCodeDefined = true ;
343
+ if ( equalsDefined ) {
344
+ break ;
345
+ }
341
346
}
342
347
}
348
+ if (equalsDefined && hashCodeDefined ) {
349
+ break ;
350
+ }
343
351
}
352
+ this .equalsDefined = equalsDefined ;
353
+ this .hashCodeDefined = hashCodeDefined ;
344
354
}
345
355
}
346
356
0 commit comments