Closed darylrobbins closed 2 months ago
I am using
I have created a minimal test case to reproduce the issue here: https://github.com/darylrobbins/rewrite-test/tree/missingimp
I am using the Gradle plugin, and my project is a single module project.
plugins { id("java") id("org.openrewrite.rewrite") version "6.11.2" } group = "org.sample.rewrite" version = "1.0-SNAPSHOT" repositories { mavenCentral() } dependencies { testImplementation(platform("org.junit:junit-bom:5.10.0")) testImplementation("org.junit.jupiter:junit-jupiter") rewrite(platform("org.openrewrite.recipe:rewrite-recipe-bom:2.9.0")) rewrite("org.openrewrite.recipe:rewrite-migrate-java") } dependencies { } rewrite { activeRecipe( "org.sample.rewrite.AddMissingMethodImplementation" ) } tasks.test { useJUnitPlatform() }
Here is the recipe:
type: specs.openrewrite.org/v1beta/recipe name: org.sample.rewrite.AddMissingMethodImplementation displayName: Adds missing JDBC interface methods. description: Add method implementations stubs to classes that implement JDBC interfaces. recipeList: - org.openrewrite.java.migrate.AddMissingMethodImplementation: fullyQualifiedClassName: javax.sql.CommonDataSource methodPattern: "*..* getParentLogger()" methodTemplateString: "public java.util.logging.Logger getParentLogger() { \n\t// TODO Auto-generated method stub\n return null; }"
Here is a Java interface in the codebase:
public interface MyDatasourceInterface extends DataSource { }
public interface MyDatasourceInterface extends DataSource { public java.util.logging.Logger getParentLogger() { // TODO Auto-generated method stub return null; } }
What version of OpenRewrite are you using?
I am using
How are you running OpenRewrite?
I have created a minimal test case to reproduce the issue here: https://github.com/darylrobbins/rewrite-test/tree/missingimp
I am using the Gradle plugin, and my project is a single module project.
What is the smallest, simplest way to reproduce the problem?
Here is the recipe:
Here is a Java interface in the codebase:
What did you expect to see?
What did you see instead?