Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix type pollution RabbitListenerAnnotationBeanPostProcessor #1528

Closed
dreis2211 opened this issue Oct 28, 2022 · 0 comments
Closed

Fix type pollution RabbitListenerAnnotationBeanPostProcessor #1528

dreis2211 opened this issue Oct 28, 2022 · 0 comments

Comments

@dreis2211
Copy link
Contributor

dreis2211 commented Oct 28, 2022

Hi 👋

I've been recently playing with the https://github.com/RedHatPerf/type-pollution-agent from @franz1981 and found that RabbitListenerAnnotationBeanPostProcessor - more specifically findListenerAnnotations - seems to be causing the TOP 3 for us during startup.

3:      java.util.ArrayList
Count:  16432
Types:
        java.util.List
        java.util.Collection
        java.lang.Iterable
Traces:
        org.springframework.amqp.rabbit.annotation.RabbitListenerAnnotationBeanPostProcessor.findListenerAnnotations(Rabbi
tListenerAnnotationBeanPostProcessor.java:345)
                class: java.util.Collection
                count: 8123
        org.springframework.core.annotation.TypeMappedAnnotations.getAggregates(TypeMappedAnnotations.java:226)
                class: java.util.List
                count: 7905
...

The method returns Collection (and has corresponding type cast internally), while it returns a List really. Everyone else in the traces seems to use largely List as well (see the next trace e.g.). Even if this is a false-positive in terms of actual type pollution it seems like a simple enough fix to be on the safe side. I'll provide a PR shortly where further discussion can happen, but I needed this issue to stick to the commit convention ;-)

Cheers,
Christoph

dreis2211 added a commit to dreis2211/spring-amqp that referenced this issue Oct 28, 2022
garyrussell pushed a commit that referenced this issue Oct 28, 2022
GH-1528: Fix possible type pollution in RabbitListenerAnnotationBeanPostProcessor

Resolves #1528
@garyrussell garyrussell added this to the 3.0.0 milestone Oct 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants