Restore retrieval of plain annotations through direct presence checks

Includes deprecation of several AnnotationUtils methods and nullability refinements for passed-in function arguments at the MergedAnnotation API level... also, MergedAnnotation.getType() returns a Class now.

Closes gh-22663
Closes gh-22685
This commit is contained in:
Juergen Hoeller
2019-03-26 16:13:41 +01:00
parent f7a4850675
commit 210b178922
16 changed files with 430 additions and 552 deletions

View File

@@ -521,9 +521,10 @@ public class AutowiredAnnotationBeanPostProcessor extends InstantiationAwareBean
* @param ann the Autowired annotation
* @return whether the annotation indicates that a dependency is required
*/
@SuppressWarnings("deprecation")
protected boolean determineRequiredStatus(MergedAnnotation<?> ann) {
return determineRequiredStatus(
ann.asMap(mergedAnnotation -> new AnnotationAttributes()));
return determineRequiredStatus((AnnotationAttributes)
ann.asMap(mergedAnnotation -> new AnnotationAttributes(mergedAnnotation.getType())));
}
/**
@@ -533,7 +534,7 @@ public class AutowiredAnnotationBeanPostProcessor extends InstantiationAwareBean
* or method when no beans are found.
* @param ann the Autowired annotation
* @return whether the annotation indicates that a dependency is required
* @deprecated since 5.2 in favor of {@link #determineRequiredStatus(MergedAnnotation)}
* @deprecated since 5.2, in favor of {@link #determineRequiredStatus(MergedAnnotation)}
*/
@Deprecated
protected boolean determineRequiredStatus(AnnotationAttributes ann) {