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

Avoid cloning empty Annotation array in TypeDescriptor #32405

Closed

Conversation

kilink
Copy link
Contributor

@kilink kilink commented Mar 10, 2024

Rework AnnotatedElementAdapter to avoid cloning the underlying Annotation array if it is empty when getAnnotations() is called.

Additionally, make the class static and add a factory method that returns a singleton instance for null or an empty Annotation arrays.

Rework AnnotatedElementAdapter to avoid cloning the underlying Annotation array if it is empty when
getAnnotations is called. Additionally, make the class static and add a factory method that returns
a singleton instance for null or empty Annotation arrays.
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Mar 10, 2024
@sbrannen sbrannen self-assigned this Mar 10, 2024
@sbrannen sbrannen added in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Mar 10, 2024
@sbrannen sbrannen added this to the 6.2.0-M1 milestone Mar 10, 2024
@sbrannen sbrannen closed this in 7fa2a28 Mar 10, 2024
sbrannen added a commit that referenced this pull request Mar 10, 2024
@sbrannen
Copy link
Member

This has been merged into main in 7fa2a28 and revised in 5345a13.

Thanks

@sbrannen sbrannen changed the title Avoid cloning empty Annotation array in TypeDescriptor Avoid cloning empty Annotation array in TypeDescriptor Mar 10, 2024
@kilink kilink deleted the type-descriptor-empty-annotations branch March 15, 2024 20:01
@jhoeller jhoeller modified the milestones: 6.2.0-M1, 6.1.6 Mar 16, 2024
@jhoeller jhoeller added for: backport-to-6.0.x Marks an issue as a candidate for backport to 6.0.x for: backport-to-5.3.x Marks an issue as a candidate for backport to 5.3.x status: backported An issue that has been backported to maintenance branches and removed for: backport-to-6.0.x Marks an issue as a candidate for backport to 6.0.x for: backport-to-5.3.x Marks an issue as a candidate for backport to 5.3.x labels Mar 16, 2024
Yangushan pushed a commit to Yangushan/spring-framework that referenced this pull request Mar 17, 2024
@jhoeller
Copy link
Contributor

Backported to 6.1.6, 6.0.19, 5.3.34 as well now since it is a straightforward internal optimization in a hot code path.

@sbrannen
Copy link
Member

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: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants