diff --git a/spring-core/src/main/java/org/springframework/core/annotation/AnnotationTypeMappings.java b/spring-core/src/main/java/org/springframework/core/annotation/AnnotationTypeMappings.java index e6fee398763e..e60231ed6dab 100644 --- a/spring-core/src/main/java/org/springframework/core/annotation/AnnotationTypeMappings.java +++ b/spring-core/src/main/java/org/springframework/core/annotation/AnnotationTypeMappings.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -116,9 +116,7 @@ private void addIfPossible(Deque queue, @Nullable Annotat queue.addLast(new AnnotationTypeMapping(source, annotationType, ann)); } catch (Exception ex) { - if (ex instanceof AnnotationConfigurationException) { - throw (AnnotationConfigurationException) ex; - } + AnnotationUtils.rethrowAnnotationConfigurationException(ex); if (failureLogger.isEnabled()) { failureLogger.log("Failed to introspect meta-annotation " + annotationType.getName(), (source != null ? source.getAnnotationType() : null), ex); diff --git a/spring-core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java b/spring-core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java index f80d0c7c335c..b7f7f959fd15 100644 --- a/spring-core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java +++ b/spring-core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -1076,7 +1076,7 @@ public static Object getValue(@Nullable Annotation annotation, @Nullable String *

Otherwise, this method does nothing. * @param ex the throwable to inspect */ - private static void rethrowAnnotationConfigurationException(Throwable ex) { + static void rethrowAnnotationConfigurationException(Throwable ex) { if (ex instanceof AnnotationConfigurationException) { throw (AnnotationConfigurationException) ex; } diff --git a/spring-core/src/main/java/org/springframework/core/annotation/TypeMappedAnnotation.java b/spring-core/src/main/java/org/springframework/core/annotation/TypeMappedAnnotation.java index b2939c59dcdc..8975dc3f63ee 100644 --- a/spring-core/src/main/java/org/springframework/core/annotation/TypeMappedAnnotation.java +++ b/spring-core/src/main/java/org/springframework/core/annotation/TypeMappedAnnotation.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -672,9 +672,7 @@ private static TypeMappedAnnotation createIfPossible( valueExtractor, aggregateIndex); } catch (Exception ex) { - if (ex instanceof AnnotationConfigurationException) { - throw (AnnotationConfigurationException) ex; - } + AnnotationUtils.rethrowAnnotationConfigurationException(ex); if (logger.isEnabled()) { String type = mapping.getAnnotationType().getName(); String item = (mapping.getDistance() == 0 ? "annotation " + type :