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 {Mono,Flux}OfType Refaster rules #810

Merged
merged 2 commits into from
Oct 9, 2023
Merged

Conversation

werli
Copy link
Member

@werli werli commented Oct 4, 2023

Since semantically this should be equivalent.

Suggested commit message:

Introduce `{Mono,Flux}OfType` Refaster rules (#810)

@werli werli added this to the 0.15.0 milestone Oct 4, 2023
@werli werli changed the title Introduce assorted Reactor Refaster rules Introduce {Mono,Flux}OfType Refaster rules Oct 4, 2023
@github-actions
Copy link

github-actions bot commented Oct 4, 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.

Copy link
Member

@Stephan202 Stephan202 left a comment

Choose a reason for hiding this comment

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

Nice! Will finalize review later.

Comment on lines 803 to 804
Refaster.<S>clazz()::isInstance,
x -> Refaster.<S>clazz().isAssignableFrom(x.getClass())))
Copy link
Member

Choose a reason for hiding this comment

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

We can introduce a separate rule to prefer the first over the second. (I have this change locally already, but need to leave the train now 😅.)

Copy link
Member

Choose a reason for hiding this comment

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

I filed #811 for this.

Copy link
Member

@Stephan202 Stephan202 left a comment

Choose a reason for hiding this comment

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

Rebased the PR on top of #811 and added a commit. Very nice addition @werli!

Comment on lines 803 to 804
Refaster.<S>clazz()::isInstance,
x -> Refaster.<S>clazz().isAssignableFrom(x.getClass())))
Copy link
Member

Choose a reason for hiding this comment

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

I filed #811 for this.

Mono<S> before(Mono<T> mono) {
return mono.filter(
Refaster.anyOf(
Refaster.<S>clazz()::isInstance,
Copy link
Member

Choose a reason for hiding this comment

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

Instead of Refaster.<S>clazz() we can use a Class<S> clazz parameter, in which case non-literal class references are also captured.

@github-actions
Copy link

github-actions bot commented Oct 4, 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.

Copy link
Member Author

@werli werli left a comment

Choose a reason for hiding this comment

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

The latest changes LGTM, thanks @Stephan202 💪


@AfterTemplate
Mono<S> after(Mono<T> mono, Class<S> clazz) {
return mono.ofType(clazz);
Copy link
Contributor

Choose a reason for hiding this comment

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

nice, didn't know this existed, will rewrite some uses in our code 😄 🚀

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.

Rebased onto master! Looks good 🚀

@github-actions
Copy link

github-actions bot commented Oct 9, 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.

@github-actions
Copy link

github-actions bot commented Oct 9, 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.

@sonarcloud
Copy link

sonarcloud bot commented Oct 9, 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 583e51c into master Oct 9, 2023
17 checks passed
@rickie rickie deleted the werli/publisher-typeof branch October 9, 2023 09:57
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.

4 participants