-
Notifications
You must be signed in to change notification settings - Fork 38.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix infinite loop bug in AnnotationScanner #25429
Conversation
@yilianhuaixiao Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
@yilianhuaixiao Thank you for signing the Contributor License Agreement! |
Have you encountered an exception or some form of infinite loop in your code regarding your proposed change? If so, please elaborate. In any case, please add a test to this PR that fails before the proposed change and passes after the proposed change. Thanks |
I add the testcase. |
@sbrannen Thanks for your advice |
Thanks! We'll look into it. |
Tentatively slated for 5.3 M2 for investigation. |
This has been merged into Thanks! @yilianhuaixiao, out of curiosity, since this code path is not executed in production code, how did you notice this bug? |
PR spring-projectsgh-25429 brought it to our attention that there was a bug in AnnotationScanner when using a non-null class filter that filtered out classes; however, it turns out that there is no production code that utilizes the package-private class filtering support. This commit therefore removes all class filtering support from AnnotationScanner since that functionality was effectively unused.
See also #25477 |
@sbrannen I am learning the spring-core source codes rencently. |
PR spring-projectsgh-25429 brought it to our attention that there was a bug in AnnotationScanner when using a non-null class filter that filtered out classes; however, it turns out that there is no production code that utilizes the package-private class filtering support. This commit therefore removes all class filtering support from AnnotationScanner since that functionality is effectively unused. Closes spring-projectsgh-25477
Prior to this commit, scanning for annotations resulted in an infinite loop when using the INHERITED_ANNOTATIONS search strategy and a class filter that filters out visited classes. This commit avoids an infinite loop in AnnotationsScanner's processClassInheritedAnnotations(...) method by skipping the current level of the class hierarchy when the current source class has been filtered out. Closes spring-projectsgh-25429
PR spring-projectsgh-25429 brought it to our attention that there was a bug in AnnotationScanner when using a non-null class filter that filtered out classes; however, it turns out that there is no production code that utilizes the package-private class filtering support. This commit therefore removes all class filtering support from AnnotationScanner since that functionality is effectively unused. Closes spring-projectsgh-25477
The original code
isFiltered(source, context, classFilter)
when true,would cause dead circle.
Maybe new code is right.