File tree 1 file changed +13
-8
lines changed
spring-context/src/main/java/org/springframework/context/annotation
1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2016 the original author or authors.
2
+ * Copyright 2002-2017 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -366,15 +366,20 @@ private Set<MethodMetadata> retrieveBeanMethodMetadata(SourceClass sourceClass)
366
366
AnnotationMetadata asm =
367
367
this .metadataReaderFactory .getMetadataReader (original .getClassName ()).getAnnotationMetadata ();
368
368
Set <MethodMetadata > asmMethods = asm .getAnnotatedMethods (Bean .class .getName ());
369
- Set <MethodMetadata > reflectionMethods = beanMethods ;
370
- beanMethods = new LinkedHashSet <MethodMetadata >();
371
- for (MethodMetadata asmMethod : asmMethods ) {
372
- for (MethodMetadata reflectionMethod : reflectionMethods ) {
373
- if (reflectionMethod .getMethodName ().equals (asmMethod .getMethodName ())) {
374
- beanMethods .add (reflectionMethod );
375
- break ;
369
+ if (asmMethods .size () >= beanMethods .size ()) {
370
+ Set <MethodMetadata > selectedMethods = new LinkedHashSet <MethodMetadata >(asmMethods .size ());
371
+ for (MethodMetadata asmMethod : asmMethods ) {
372
+ for (MethodMetadata beanMethod : beanMethods ) {
373
+ if (beanMethod .getMethodName ().equals (asmMethod .getMethodName ())) {
374
+ selectedMethods .add (beanMethod );
375
+ break ;
376
+ }
376
377
}
377
378
}
379
+ if (selectedMethods .size () == beanMethods .size ()) {
380
+ // All reflection-detected methods found in ASM method set -> proceed
381
+ beanMethods = selectedMethods ;
382
+ }
378
383
}
379
384
}
380
385
catch (IOException ex ) {
You can’t perform that action at this time.
0 commit comments