Skip to content

Improve default annotation values #9838

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

Merged
merged 2 commits into from
Sep 12, 2023
Merged

Improve default annotation values #9838

merged 2 commits into from
Sep 12, 2023

Conversation

dstepanov
Copy link
Contributor

@dstepanov dstepanov commented Sep 7, 2023

Added Core annotations default values to prevent repeating them in bean definitions.
Fixed a bug with missing defaults for nested annotations.
Changed for AnnotationValues to have default values fetched lazily, preventing additional calls to the concurrent map during the class init.

We might want to remove additional calls to fill Map<String, Class<? extends Annotation>> ANNOTATION_TYPES and make that resolution at the runtime. In don't think AnnotationMetadata Optional<Class<? extends Annotation>> getAnnotationType(@NonNull String name) is very much used.

@dstepanov dstepanov marked this pull request as draft September 7, 2023 10:02
@sonarqubecloud
Copy link

sonarqubecloud bot commented Sep 7, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 8 Code Smells

97.6% 97.6% Coverage
0.0% 0.0% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

@dstepanov dstepanov marked this pull request as ready for review September 8, 2023 08:45
* @return The annotation default values
*/
@NonNull
Map<CharSequence, Object> provide(String annotationName);
Copy link
Member

Choose a reason for hiding this comment

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

Why CharSequence instead of String?

CS doesn't have a well-defined eq/hc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not really sure, we have it everywere

Copy link
Member

Choose a reason for hiding this comment

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

CharSequence is parent of both Java's String and Groovy's GString.

Copy link
Member

Choose a reason for hiding this comment

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

that means we need it for the processor i guess, but maybe we can move to String on the runtime side

@dstepanov
Copy link
Contributor Author

@graemerocher Pls also check

@dstepanov dstepanov added this to the 4.2.0 milestone Sep 12, 2023
@dstepanov dstepanov added the type: improvement A minor improvement to an existing feature label Sep 12, 2023
@dstepanov dstepanov merged commit bb458a8 into 4.2.x Sep 12, 2023
@dstepanov dstepanov deleted the annimprov branch September 12, 2023 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: improvement A minor improvement to an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants