Skip to content

Commit

Permalink
GH-1528: Fix Possible Type Pollution
Browse files Browse the repository at this point in the history
GH-1528: Fix possible type pollution in RabbitListenerAnnotationBeanPostProcessor

Resolves #1528
  • Loading branch information
dreis2211 authored and garyrussell committed Oct 28, 2022
1 parent f2fc13b commit 4180203
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -323,12 +323,12 @@ public Object postProcessAfterInitialization(final Object bean, final String bea
}

private TypeMetadata buildMetadata(Class<?> targetClass) {
Collection<RabbitListener> classLevelListeners = findListenerAnnotations(targetClass);
List<RabbitListener> classLevelListeners = findListenerAnnotations(targetClass);
final boolean hasClassLevelListeners = classLevelListeners.size() > 0;
final List<ListenerMethod> methods = new ArrayList<>();
final List<Method> multiMethods = new ArrayList<>();
ReflectionUtils.doWithMethods(targetClass, method -> {
Collection<RabbitListener> listenerAnnotations = findListenerAnnotations(method);
List<RabbitListener> listenerAnnotations = findListenerAnnotations(method);
if (listenerAnnotations.size() > 0) {
methods.add(new ListenerMethod(method,
listenerAnnotations.toArray(new RabbitListener[listenerAnnotations.size()])));
Expand All @@ -349,7 +349,7 @@ private TypeMetadata buildMetadata(Class<?> targetClass) {
classLevelListeners.toArray(new RabbitListener[classLevelListeners.size()]));
}

private Collection<RabbitListener> findListenerAnnotations(AnnotatedElement element) {
private List<RabbitListener> findListenerAnnotations(AnnotatedElement element) {
return MergedAnnotations.from(element, SearchStrategy.TYPE_HIERARCHY)
.stream(RabbitListener.class)
.map(ann -> ann.synthesize())
Expand Down

0 comments on commit 4180203

Please sign in to comment.