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

Require meta-annotations with source rentetion for Immutables styles #1727

Merged
merged 3 commits into from
Jun 2, 2021

Conversation

pkoenig10
Copy link
Member

@pkoenig10 pkoenig10 commented Apr 14, 2021

Update ImmutablesStyleCollision check to make it stricter by requiring meta-annotations with source retention.

Use inline annotations or meta-annotations with other retention policies forces a consumers to add an Immutables annotations compile dependency to avoid compile warnings.

For more details see immutables/immutables#291 - specifically the recommendation not to use inline styles.

Also the recommended way for the styles to be applied is via package (possibly even some parent package) or via a custom style annotation (which also may be attached to class or to a package). Inline styles should be used only for experimentation.

We manually made this change in our repos, some examples:

@changelog-app
Copy link

changelog-app bot commented Apr 14, 2021

Generate changelog in changelog/@unreleased

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

Update ImmutablesStyleCollision check to require meta-annotations with source retention.

Check the box to generate changelog(s)

  • Generate changelog entry

@policy-bot policy-bot bot requested a review from ferozco April 14, 2021 18:50
@stale
Copy link

stale bot commented May 6, 2021

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.

@stale stale bot added the stale label May 6, 2021
@pkoenig10
Copy link
Member Author

Would still like a review of this.

@stale stale bot removed the stale label May 7, 2021
@pkoenig10 pkoenig10 requested a review from CRogers May 9, 2021 18:35
+ "meta-annotation, or add the meta-annotation's fields to your inline @Value.Style "
+ "declaration.")
public final class ImmutablesStyleCollision extends BugChecker implements BugChecker.ClassTreeMatcher {
severity = SeverityLevel.WARNING,
Copy link
Member Author

Choose a reason for hiding this comment

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

Changed to WARNING so users have an escape hatch

@pkoenig10 pkoenig10 requested a review from fawind May 29, 2021 21:04
Copy link
Contributor

@fawind fawind left a comment

Choose a reason for hiding this comment

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

Looks good. Yeah, makes sense to use WARNING initially. Can always raise this in the future if necessary.

@bulldozer-bot bulldozer-bot bot merged commit e04c0ca into develop Jun 2, 2021
@bulldozer-bot bulldozer-bot bot deleted the pkoenig/immutablesStyle branch June 2, 2021 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants