Skip to content

MergedAnnotation does not use ClassLoader for method or field#36606

Closed
nameearly wants to merge 1 commit intospring-projects:mainfrom
nameearly:main
Closed

MergedAnnotation does not use ClassLoader for method or field#36606
nameearly wants to merge 1 commit intospring-projects:mainfrom
nameearly:main

Conversation

@nameearly
Copy link
Copy Markdown

I checked carefully, something goes wrong without return.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Apr 6, 2026
Copy link
Copy Markdown
Contributor

@DhruvTheDev1 DhruvTheDev1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, the logic seems to be correct as the missing return was definitely causing the classLoader to be lost. Maybe a quick unit test to verify the member source now correctly returns its loader instead of null.

@sbrannen sbrannen self-assigned this Apr 7, 2026
@sbrannen sbrannen added type: bug A general bug in: core Issues in core modules (aop, beans, core, context, expression) and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Apr 7, 2026
@sbrannen sbrannen added this to the 7.0.7 milestone Apr 7, 2026
@sbrannen sbrannen changed the title fix : add one lost return MergedAnnotation does not use ClassLoader for method or field Apr 7, 2026
@sbrannen sbrannen closed this in f3b6c22 Apr 7, 2026
@sbrannen
Copy link
Copy Markdown
Member

sbrannen commented Apr 7, 2026

Thanks for bringing this to our attention! 👍

Since the commit had not been signed off and also did not include a test, I went ahead and completed this myself in f3b6c22.

sbrannen added a commit that referenced this pull request Apr 7, 2026
Prior to this commit, the `return` keyword was missing in
TypeMappedAnnotation's getClassLoader() implementation, which prevented
the ClassLoader of the Member (Method or Field) from being used.

This commit fixes that by adding the missing `return` keyword and adds
a test using a custom ClassLoader to verify the correct behavior.

Closes gh-36606

(cherry picked from commit f3b6c22)
@github-actions github-actions bot added the status: backported An issue that has been backported to maintenance branches label Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in: core Issues in core modules (aop, beans, core, context, expression) status: backported An issue that has been backported to maintenance branches type: bug A general bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants