What version of OpenRewrite are you using?
I am using
- Maven plugin v6.32.0
- rewrite-spring v6.26.0
How are you running OpenRewrite?
I am using the Maven plugin, and my project is a single module project.
https://github.com/thethyka/issue-reproducing/tree/main
(mockwebserver-shutdown-issue)
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<version>6.32.0</version>
<configuration>
<activeRecipes>
<recipe>org.openrewrite.java.spring.boot4.UpgradeSpringBoot_4_0</recipe>
</activeRecipes>
</configuration>
<dependencies>
<dependency>
<groupId>org.openrewrite.recipe</groupId>
<artifactId>rewrite-spring</artifactId>
<version>6.26.0</version>
</dependency>
</dependencies>
</plugin>
What is the smallest, simplest way to reproduce the problem?
When running the Spring Boot upgrade recipes that upgrade OkHttp mockwebserver dependencies (from v4 to v5), okhttp3.mockwebserver.MockWebServer gets replaced with mockwebserver3.MockWebServer correctly, but the shutdown() method doesn't get rewritten to close().
package com.example;
import okhttp3.mockwebserver.MockWebServer;
import java.io.IOException;
public class MockWebServerShutdownIssueTest {
public void testServerClose() throws IOException {
MockWebServer mockWebServer = new MockWebServer();
mockWebServer.start();
// Perform tests...
mockWebServer.shutdown();
}
}
What did you expect to see?
The mockwebserver3.MockWebServer usage dictates using close() since it implements Closeable. I expect the shutdown() calls to be updated to close().
package com.example;
import mockwebserver3.MockWebServer;
import java.io.IOException;
public class MockWebServerShutdownIssueTest {
public void testServerClose() throws IOException {
MockWebServer mockWebServer = new MockWebServer();
mockWebServer.start();
// Perform tests...
mockWebServer.close();
}
}
What did you see instead?
The dependency and import are rewritten correctly, but the compiler fails later because the shutdown() method call remains untouched.
package com.example;
import mockwebserver3.MockWebServer;
import java.io.IOException;
public class MockWebServerShutdownIssueTest {
public void testServerClose() throws IOException {
MockWebServer mockWebServer = new MockWebServer();
mockWebServer.start();
// Perform tests...
mockWebServer.shutdown();
}
}
What is the full stack trace of any errors you encountered?
cannot find symbol
symbol: method shutdown()
location: variable mockWebServer of type mockwebserver3.MockWebServer
Yes.
What version of OpenRewrite are you using?
I am using
How are you running OpenRewrite?
I am using the Maven plugin, and my project is a single module project.
https://github.com/thethyka/issue-reproducing/tree/main
(mockwebserver-shutdown-issue)
What is the smallest, simplest way to reproduce the problem?
When running the Spring Boot upgrade recipes that upgrade OkHttp mockwebserver dependencies (from v4 to v5), okhttp3.mockwebserver.MockWebServer gets replaced with mockwebserver3.MockWebServer correctly, but the shutdown() method doesn't get rewritten to close().
What did you expect to see?
The mockwebserver3.MockWebServer usage dictates using close() since it implements Closeable. I expect the shutdown() calls to be updated to close().
What did you see instead?
The dependency and import are rewritten correctly, but the compiler fails later because the shutdown() method call remains untouched.
What is the full stack trace of any errors you encountered?
Are you interested in contributing a fix to OpenRewrite?
Yes.