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

ImmutablesInterfaceDefaultValue check for config interfaces. #2968

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

rhuffy
Copy link

@rhuffy rhuffy commented Nov 27, 2024

Re-opening #1761, but only applying the check to config Immutables. It would be better if the server library could tell us which Classes are Config classes, but currently this PR checks for an @ImmutablesConfigStyle annotation.

Before this PR

In code reviews, noticed some uses of @Value.Immutable on default methods in interfaces without corresponding @Value.Default, @Value.Lazy or @Value.Derived.

It is sometimes the case that default methods are used for helper functions that should not be serialized or included in builders, meaning that it would not be correct to require one of those annotations in all cases. This PR gives the option to annotate with @JsonIgnore to encourage the programmer to more clearly specify their intent.

After this PR

==COMMIT_MSG==
ImmutablesInterfaceDefaultValue check for config interfaces.
==COMMIT_MSG==

Possible downsides?

  • Refactoring suggestion assumes @Value.Default was intended if not already annotated @Value.Lazy or @Value.Derived.
  • @JsonIgnore requires the Jackson library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants