-
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
Introduce ImmutableTableRules
Refaster rule collection
#1489
base: master
Are you sure you want to change the base?
Conversation
Looks good. No mutations were possible for these changes. |
Quality Gate passedIssues Measures |
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.
🪓
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.
Sorry, I wanted to add some comments; leaving approval otherwise 👍
@UseImportPolicy(STATIC_IMPORT_ALWAYS) | ||
ImmutableTable<R, C, V> after(Stream<E> stream) { | ||
return stream.collect( | ||
toImmutableTable(e -> rowFunction(e), e -> columnFunction(e), e -> valueFunction(e))); |
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.
Can't these can be lambda expressions?
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.
You mean method references? 🙃
Unfortunately, Refaster doesn't have a "make this a method reference if possible" feature.
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.
You mean method references? 🙃
Yes, sorry 🙈
private ImmutableTableRules() {} | ||
|
||
/** Prefer {@link ImmutableTable#builder()} over the associated constructor. */ | ||
// XXX: This rule may drop generic type information, leading to non-compilable code. |
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.
Technically it does not drop all generic type information, correct?
// XXX: This rule may drop generic type information, leading to non-compilable code. | |
// XXX: This rule may drop explicit generic type information, leading to non-compilable code. |
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.
Indeed, but it also says "may", so it's clear that anyway this is an issue only in a subset of cases. :)
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.
Tnx for the review @mohamedsamehsalah!
private ImmutableTableRules() {} | ||
|
||
/** Prefer {@link ImmutableTable#builder()} over the associated constructor. */ | ||
// XXX: This rule may drop generic type information, leading to non-compilable code. |
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.
Indeed, but it also says "may", so it's clear that anyway this is an issue only in a subset of cases. :)
@UseImportPolicy(STATIC_IMPORT_ALWAYS) | ||
ImmutableTable<R, C, V> after(Stream<E> stream) { | ||
return stream.collect( | ||
toImmutableTable(e -> rowFunction(e), e -> columnFunction(e), e -> valueFunction(e))); |
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.
You mean method references? 🙃
Unfortunately, Refaster doesn't have a "make this a method reference if possible" feature.
Validated that these changes do not impact the integration tests. |
Suggested commit message:
This work results from #1223 and this comment, with the observation that
ImmutableTable
has a distinct builder type. The rules introduced here are a subset of those defined byImmutableMapRules
.