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

update method type on DeleteMethodArgument #3660

Merged
merged 1 commit into from
Nov 3, 2023

Conversation

joanvr
Copy link
Contributor

@joanvr joanvr commented Nov 3, 2023

What's changed?

Updating method type list of arguments to avoid next calls to the recipe to keep method matching

What's your motivation?

Right now this recipe is not idempotent, thus we need to specify in the tests that we only want one cycle. This is not very convenient when using this recipe from other recipes, and also leaves the method in an inconsistent state.

Anyone you would like to review specifically?

@timtebeek

Any additional context

I had to change a test, that was relying specifically on the fact that the method type is not updated and that subsequent calls to the recipe will still match and delete the parameter. I do not know if this is also used in recipes that are using this one.

Checklist

  • I've added unit tests to cover both positive and negative cases
  • I've added the license header to any new files through ./gradlew licenseFormat
  • I've used the IntelliJ IDEA auto-formatter on affected files

@joanvr joanvr requested review from timtebeek and ranuradh November 3, 2023 14:51
@joanvr joanvr self-assigned this Nov 3, 2023
@joanvr joanvr added the enhancement New feature or request label Nov 3, 2023
Copy link
Contributor

@timtebeek timtebeek left a comment

Choose a reason for hiding this comment

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

Thanks for the quick work on this!

@timtebeek timtebeek merged commit 2d1a536 into main Nov 3, 2023
1 check passed
@timtebeek timtebeek deleted the fix/delete-method-argument branch November 3, 2023 15:07
Comment on lines -68 to +66
new DeleteMethodArgument("B foo(int, int, int)", 1)
new DeleteMethodArgument("B foo(int, int)", 1)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since we are updating the methodType, now it is required to match the new resulting "signature"

Copy link
Contributor

Choose a reason for hiding this comment

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

Here is one case where that was required: openrewrite/rewrite-testing-frameworks@47ccd37

knutwannheden added a commit to openrewrite/rewrite-testing-frameworks that referenced this pull request Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants