-
Notifications
You must be signed in to change notification settings - Fork 75
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
AddMissingMethodImplementation should check for superclass implementations of the relevant method #466
Comments
@cjobinabo Since rewrite-migrate-java/src/main/resources/META-INF/rewrite/java-version-7.yml Lines 31 to 41 in ee91666
|
I saw this in practice today, on subclasses of Spring's AbstractDataSource. |
Thanks for the heads up, Tim (I know I'm super late to your message 😓). I'll try to keep an eye out for updates addressing this GitHub issue. |
What problem are you trying to solve?
Currently, the
AddMissingMethodImplementation
checks primarily for existing method declarations on the visited class declaration. It does not check whether the visited class has a superclass which already provides an implementation of the relevant method.What precondition(s) should be checked before applying this recipe?
Existing recipe, no suggested precondition changes
Describe the situation before applying the recipe
Describe the situation after applying the recipe
If we run a recipe like this:
...then we would get this:
But if we run this
...then we would get no change, because MyClass already has an implementation of
bar()
fromMyBaseClass
.Have you considered any alternatives or workarounds?
This behavior could also be disabled with a new option (default enabled)
Any additional context
Are you interested in contributing this recipe to OpenRewrite?
Maybe eventually; could also be a good first issue
The text was updated successfully, but these errors were encountered: