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 48abacda1ec..fce31c0e41d 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
@@ -531,7 +531,7 @@ public abstract class AnnotationUtils {
*/
@SuppressWarnings("unchecked")
@Nullable
- public static A findAnnotation(Method method, Class annotationType) {
+ public static A findAnnotation(Method method, @Nullable Class annotationType) {
Assert.notNull(method, "Method must not be null");
if (annotationType == null) {
return null;
@@ -656,7 +656,9 @@ public abstract class AnnotationUtils {
*/
@SuppressWarnings("unchecked")
@Nullable
- private static A findAnnotation(Class> clazz, Class annotationType, boolean synthesize) {
+ private static A findAnnotation(
+ Class> clazz, @Nullable Class annotationType, boolean synthesize) {
+
Assert.notNull(clazz, "Class must not be null");
if (annotationType == null) {
return null;
@@ -1316,7 +1318,7 @@ public abstract class AnnotationUtils {
* @see #rethrowAnnotationConfigurationException(Throwable)
*/
@Nullable
- public static Object getValue(Annotation annotation, String attributeName) {
+ public static Object getValue(@Nullable Annotation annotation, @Nullable String attributeName) {
if (annotation == null || !StringUtils.hasText(attributeName)) {
return null;
}
@@ -1356,7 +1358,7 @@ public abstract class AnnotationUtils {
* @see #getDefaultValue(Class, String)
*/
@Nullable
- public static Object getDefaultValue(Annotation annotation, String attributeName) {
+ public static Object getDefaultValue(@Nullable Annotation annotation, @Nullable String attributeName) {
if (annotation == null) {
return null;
}
@@ -1384,7 +1386,9 @@ public abstract class AnnotationUtils {
* @see #getDefaultValue(Annotation, String)
*/
@Nullable
- public static Object getDefaultValue(Class extends Annotation> annotationType, String attributeName) {
+ public static Object getDefaultValue(
+ @Nullable Class extends Annotation> annotationType, @Nullable String attributeName) {
+
if (annotationType == null || !StringUtils.hasText(attributeName)) {
return null;
}
@@ -1440,7 +1444,8 @@ public abstract class AnnotationUtils {
@SuppressWarnings("unchecked")
static A synthesizeAnnotation(A annotation, @Nullable Object annotatedElement) {
- if (annotation == null || annotation instanceof SynthesizedAnnotation) {
+ Assert.notNull(annotation, "Annotation must not be null");
+ if (annotation instanceof SynthesizedAnnotation) {
return annotation;
}