Skip to content

Commit 9134588

Browse files
committed
Never return null from AnnotationMetadata.getMetaAnnotationTypes
Issue: SPR-17046 (cherry picked from commit cacd14c)
1 parent d283424 commit 9134588

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

spring-core/src/main/java/org/springframework/core/type/classreading/AnnotationMetadataReadingVisitor.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
1717
package org.springframework.core.type.classreading;
1818

1919
import java.util.Collection;
20+
import java.util.Collections;
2021
import java.util.LinkedHashMap;
2122
import java.util.LinkedHashSet;
2223
import java.util.List;
@@ -98,7 +99,8 @@ public Set<String> getAnnotationTypes() {
9899

99100
@Override
100101
public Set<String> getMetaAnnotationTypes(String annotationName) {
101-
return this.metaAnnotationMap.get(annotationName);
102+
Set<String> metaAnnotationTypes = this.metaAnnotationMap.get(annotationName);
103+
return (metaAnnotationTypes != null ? metaAnnotationTypes : Collections.emptySet());
102104
}
103105

104106
@Override

0 commit comments

Comments
 (0)