From 9e1ed6c7718d38c4b9fe5f75921abad33264307c Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Sun, 12 May 2019 13:46:14 +0200 Subject: [PATCH] Fix build on JDK 9+ --- .../annotation/AutowiredAnnotationBeanPostProcessor.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java b/spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java index 76bb9d197b..6ba80cd500 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java @@ -521,9 +521,11 @@ public class AutowiredAnnotationBeanPostProcessor extends InstantiationAwareBean * @param ann the Autowired annotation * @return whether the annotation indicates that a dependency is required */ - @SuppressWarnings("deprecation") + @SuppressWarnings({ "deprecation", "cast" }) protected boolean determineRequiredStatus(MergedAnnotation ann) { - return determineRequiredStatus(ann.asMap(mergedAnnotation -> new AnnotationAttributes(mergedAnnotation.getType()))); + // The following (AnnotationAttributes) cast is required on JDK 9+. + return determineRequiredStatus((AnnotationAttributes) + ann.asMap(mergedAnnotation -> new AnnotationAttributes(mergedAnnotation.getType()))); } /**