-
Notifications
You must be signed in to change notification settings - Fork 135
Add ImmutablesDefaultValue error-prone check #3245
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
base: develop
Are you sure you want to change the base?
Conversation
This check enforces that default methods in immutable interfaces are annotated with @Value.Default to ensure they are included as fields in the generated immutable classes. Key features: - Detects default methods in @Value.Immutable interfaces - Handles @value.Style(defaultAsDefault = true) configurations - Supports meta-annotations with @value.Style - Provides automatic fixes to add missing @Value.Default annotations - Can be suppressed when methods are auxiliary and not meant as fields
- Add README.md entry documenting the new check - Add link and linkType to BugPattern annotation
The documentation now explicitly mentions that the check is disabled when @value.Style(defaultAsDefault = true) is present either directly on the interface or via meta-annotations, making it clear to users that they can use this approach to avoid the check.
Generate changelog in
|
✅ Successfully generated changelog entry!What happened?Your changelog entries have been stored in the database as part of our migration to ChangelogV3. Need to regenerate?Simply interact with the changelog bot comment again to regenerate these entries. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are legitimate reason to want a default method that is not @Value.Default. It may be a cheap computation for which we do not want to create a field that eagerly computes the value.
|
This PR has been automatically marked as stale because it has not been touched in the last 14 days. If you'd like to keep it open, please leave a comment or add the 'long-lived' label, otherwise it'll be closed in 7 days. |
This check enforces that default methods in immutable interfaces are
annotated with
@Value.Defaultto ensure they are included as fields inthe generated immutable classes.
@Value.Style(defaultAsDefault = true)configurations@Value.Style@Value.Defaultannotations