Open nmck257 opened 2 months ago
@cjobinabo Since AddMissingMethodImplementation
is heavily used in some of the recipes your team contributed I figured
let you know about this issue, as it might affect your users too. No expectation of course that you'll fix this; we're already glad with all the work that you've done, but thought it good to coordinate any changes here.
I saw this in practice today, on subclasses of Spring's AbstractDataSource.
@cjobinabo Since
AddMissingMethodImplementation
is heavily used in some of the recipes your team contributed I figured let you know about this issue, as it might affect your users too. No expectation of course that you'll fix this; we're already glad with all the work that you've done, but thought it good to coordinate any changes here.
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