-
Notifications
You must be signed in to change notification settings - Fork 39
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
Extend ImmutableMapRules
Refaster rule collection
#1488
base: master
Are you sure you want to change the base?
Conversation
1a97fa7
to
6ac49c4
Compare
Looks good. All 1 mutations in this change were killed.
Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed. |
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.
Some context.
/** | ||
* Prefer {@link ImmutableMap.Builder#buildOrThrow()} over the less explicit {@link | ||
* ImmutableMap.Builder#build()}. | ||
*/ | ||
static final class ImmutableMapBuilderBuildOrThrow<K, V> { | ||
@BeforeTemplate | ||
ImmutableMap<K, V> before(ImmutableMap.Builder<K, V> builder) { | ||
return builder.build(); | ||
} | ||
|
||
@AfterTemplate | ||
ImmutableMap<K, V> after(ImmutableMap.Builder<K, V> builder) { | ||
return builder.buildOrThrow(); | ||
} | ||
} |
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.
The builder subtypes for ImmutableBiMap
and ImmutableSortedMap
extend from ImmutableMap.Builder
, so those build()
calls are also covered.
// XXX: We could add variants in which the entry is created some other way, but we have another | ||
// rule that covers canonicalization to `Map.entry`. |
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.
Dropped, because this describes our approach more generally these days.
Looks good. All 1 mutations in this change were killed.
Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed. |
Looks good. No mutations were possible for these changes. |
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.
LGTM 🚀
Nice suggestion @EnricSala 🙌
fcd022d
to
b7d09da
Compare
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.
Rebased and updated the integration test expectations.
Map.ofEntries( | ||
- Map.ofEntries( | ||
+ ImmutableMap.ofEntries( | ||
entry("days", "d"), | ||
entry("hours", "h"), | ||
entry("minutes", "min"), |
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.
This isn't simplified further, because it's a long list. We could add more rules, but: meh.
Looks good. No mutations were possible for these changes. |
Quality Gate passedIssues Measures |
I set out to resolve #1223, then noticed a few other ways in which internal code can be simplified.
Suggested commit message: