-
Notifications
You must be signed in to change notification settings - Fork 80
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
generating stubs for methods with implementations
#648
Comments
hi @williamkmorton ; thanks for pointing this out! Indeed seems like an oversight on the recipe implementation. I'll link the relevant parts here. The declarative recipe that makes the change is configured here: rewrite-migrate-java/src/main/resources/META-INF/rewrite/java-version-6.yml Lines 30 to 42 in 2f005af
The parts that should detect the already present methods is here: rewrite-migrate-java/src/main/java/org/openrewrite/java/migrate/AddMissingMethodImplementation.java Lines 82 to 88 in 2f005af
Likely we should not look at methods declared in the class, but look at methods available in the type, such that we also pick up methods defined on an extended class, or implemented interface default method: Iterator<JavaType.Method> visibleMethods = classDecl.getType().getVisibleMethods(); Did you already explore such a fix perhaps? |
AddMissingMethodImplementation
generating stubs for methods with implementations
I've only just started exploring OpenRewrite recipes and don't really know how things work under the hood but based on the information you've shared, it seems like a relatively easy fix. I'd be happy to give it a shot. Could you give me write access to the repo? |
Thanks for the offer to help! We tend to work with forks for outside contributors, and you can open a pull request from there: |
What version of OpenRewrite are you using?
I am using
How are you running OpenRewrite?
I am using the Gradle plugin, and my project is a single module project and applying
rewrite-migrate-java
through the compositerewrite-spring
What is the smallest, simplest way to reproduce the problem?
Use the configuation above and create a class like below that extends
AbstractRoutingDataSource
and run the recipe.https://github.com/spring-projects/spring-framework/blob/main/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/lookup/AbstractRoutingDataSource.java
Only
determineCurrentLookupKey
is abstract and needs to be overridden.What did you expect to see?
What did you see instead?
What is the full stack trace of any errors you encountered?
No errors encountered.
Are you interested in contributing a fix to OpenRewrite?
The text was updated successfully, but these errors were encountered: