Skip to content

AnnotationUtils does not support arbitrary levels of meta-annotations on methods [SPR-12941] #17534

Closed

Description

@spring-projects-issues

Sam Brannen opened SPR-12941 and commented

Status Quo

In contrast to the search algorithm used by the findAnnotation(Class, Class) method in AnnotationUtils, the findAnnotation(Method, Class) method currently only finds direct annotations or direct meta-annotations (i.e., one level of meta-annotations).

This lacking support for multiple levels of meta-annotations has been the cause of failing (though currently @Ignored) tests in TransactionalEventListenerTests since @EventListener is not discovered as a meta-meta-annotation by the EventListenerMethodProcessor.

Deliverables

  1. Rework findAnnotation(Method, Class) so that it supports arbitrary levels of meta-annotations on methods.

Issue Links:

Referenced from: commits b9b0b78

Activity

  1. spring-projects-issues commented on Apr 21, 2015

    @spring-projects-issues
    CollaboratorAuthor

    Sam Brannen commented

    This is related to #17533.

  2. spring-projects-issues commented on Apr 21, 2015

    @spring-projects-issues
    CollaboratorAuthor

    Sam Brannen commented

    Fixed as described in GitHub commit b9b0b78:

    Support n meta-annotation levels on methods in AnnotationUtils

    Prior to this commit, the search algorithm used by the
    findAnnotation(Method, Class) method in AnnotationUtils only found
    direct annotations or direct meta-annotations (i.e., one level of
    meta-annotations).

    This commit reworks the search algorithm so that it supports arbitrary
    levels of meta-annotations on methods. To make this possible, a new
    findAnnotation(AnnotatedElement, Class) method has been introduced in
    AnnotationUtils.

    This fix also allows for the @Ignore'd tests in
    TransactionalEventListenerTests to be re-enabled.

  3. added
    type: bug
    in: core
    on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: coretype: bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions