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

Match method overrides in precondition #100

Merged
merged 5 commits into from
Aug 12, 2024

Conversation

timtebeek
Copy link
Contributor

What's changed?

Instead of new UsesMethod<>("java.lang.String join(..)")
Generate new UsesMethod<>("java.lang.String join(..)", true)

What's your motivation?

We want to also match methods overrridden in sub classes where possible.

Anything in particular you'd like reviewers to focus on?

Not sure if this might negatively affect some existing recipes that have come to expect stricter matching.
Figured open this PR to get the discussion around that going.

Also not yet sure if the before.matcher(getCursor())).find() would even match.

Anyone you would like to review specifically?

@knutwannheden

Have you considered any alternatives or workarounds?

We could add explicit recipes for overridden methods, but that quickly explodes the number of recipes.

We could also offer a way to tag before templates where overridden methods should also be matched.

Any additional context

Came up while discussing recipes for Apache POI, where Cell might have multiple extending classes.

@timtebeek timtebeek added enhancement New feature or request question Further information is requested labels Jul 31, 2024
@timtebeek timtebeek self-assigned this Jul 31, 2024
@timtebeek timtebeek requested a review from knutwannheden July 31, 2024 15:58
Copy link
Contributor

@knutwannheden knutwannheden left a comment

Choose a reason for hiding this comment

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

LGTM.

@timtebeek timtebeek merged commit 6cad791 into main Aug 12, 2024
1 check passed
@timtebeek timtebeek deleted the match-method-overrides-in-precondition branch August 12, 2024 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants