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

Introduce assorted Optional Refaster rules #764

Merged
merged 2 commits into from
Sep 1, 2023

Conversation

Stephan202
Copy link
Member

@Stephan202 Stephan202 commented Aug 25, 2023

Suggested commit message:

Introduce assorted `Optional` Refaster rules (#764)

While there, move the `OptionalOrElseGet` Refaster rule test code to the
correct location.

@Stephan202 Stephan202 added this to the 0.13.0 milestone Aug 25, 2023
@github-actions
Copy link

Looks good. No mutations were possible for these changes.
Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed.

@rickie rickie modified the milestones: 0.13.0, 0.14.0 Aug 25, 2023
@Stephan202 Stephan202 force-pushed the sschroevers/introduce-assorted-stream-rules branch from 19a14c3 to 28f250c Compare August 26, 2023 07:11
@github-actions
Copy link

Looks good. No mutations were possible for these changes.
Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed.

@Stephan202 Stephan202 force-pushed the sschroevers/introduce-assorted-stream-rules branch from 28f250c to b6d33e6 Compare August 29, 2023 06:53
@github-actions
Copy link

Looks good. No mutations were possible for these changes.
Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed.

Copy link
Member

@rickie rickie left a comment

Choose a reason for hiding this comment

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

Added a commit with small suggestions. Otherwise LGTM so already approving.

@@ -100,6 +100,20 @@ Function<Optional<T>, T> after() {
}
}

/** Prefer {@link Optional#equals(Object)} over more contrived alternatives. */
static final class OptionalHasValue<T, S> {
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, I'm not sure if I agree with the name based on our naming algorithm 🤔.

OptionalEquals or OptionalEqualsOptional seems more accurate, WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess even OptionalEqualsOptionalOf; but this work for me for now 👍

return optional.stream();
}
}

// XXX: Add a rule for:
// `optional.flatMap(x -> pred(x) ? Optional.empty() : Optional.of(x))` and variants.
// (Maybe canonicalize the inner expression. Maybe we rewrite already.)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// (Maybe canonicalize the inner expression. Maybe we rewrite already.)
// (Maybe canonicalize the inner expression. Maybe we rewrite it already.)

A tiny improvement IMO.

@github-actions
Copy link

Looks good. No mutations were possible for these changes.
Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed.

@rickie rickie force-pushed the sschroevers/introduce-assorted-stream-rules branch from f88cf68 to 35e7fe5 Compare August 31, 2023 14:08
@github-actions
Copy link

Looks good. No mutations were possible for these changes.
Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed.

Stephan202 and others added 2 commits September 1, 2023 11:23
While there, move the `OptionalOrElseGet` Refaster rule test code to its
properly location.
@rickie rickie force-pushed the sschroevers/introduce-assorted-stream-rules branch from 35e7fe5 to 18ecbb8 Compare September 1, 2023 09:23
@github-actions
Copy link

github-actions bot commented Sep 1, 2023

Looks good. No mutations were possible for these changes.
Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Sep 1, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@rickie rickie merged commit 1f4a684 into master Sep 1, 2023
@rickie rickie deleted the sschroevers/introduce-assorted-stream-rules branch September 1, 2023 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants