Skip to content

Annotation not found on parameter in overridden method unless method is public #35349

@sbrannen

Description

@sbrannen

Overview

While writing tests for #35342, I noticed that we have a discrepancy in our "method override" detection in MergedAnnotations and AnnotatedMethod.

Specifically, the MergedAnnotations infrastructure supports finding annotations on methods that override non-public methods (such as a protected or package-private method in a superclass).

However, AnnotatedMethod will not find an annotation on a parameter in an overridden method unless the overridden method is public.

Example

If we remove the public modifier from the following declaration, the shouldFindAnnotationOnMethodParameterInGenericAbstractSuperclass() test in AnnotatedMethodTests will fail.

Related Issues

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)in: messagingIssues in messaging modules (jms, messaging)in: webIssues in web modules (web, webmvc, webflux, websocket)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions