Skip to content

Disable JAR downloading in JavaSourceSetUpdater#7459

Merged
sambsnyd merged 1 commit intomainfrom
fix/disable-javasourceset-jar-download
Apr 22, 2026
Merged

Disable JAR downloading in JavaSourceSetUpdater#7459
sambsnyd merged 1 commit intomainfrom
fix/disable-javasourceset-jar-download

Conversation

@steve-aom-elliott
Copy link
Copy Markdown
Contributor

@steve-aom-elliott steve-aom-elliott commented Apr 22, 2026

Short-circuits JavaSourceSetUpdater.changeDependency and addDependency to return the source set unchanged, and makes downloadAndScanTypes return an empty list. This prevents MavenArtifactDownloader from being invoked during dependency-mutation recipes (AddDependency, UpgradeDependencyVersion, ChangeDependencyGroupIdAndArtifactId on Maven; AddDependency, UpgradeDependencyVersion, ChangeDependency on Gradle).

Motivation

Behavior change

  • Dependency-mutation recipes no longer update JavaSourceSet with types from new/changed dependencies.
  • Downstream recipes that read JavaSourceSet (e.g. ChangePackage star-import disambiguation) observe the pre-mutation classpath only.
  • No network calls are made from JavaSourceSetUpdater.

Tests

Two tests in ChangeDependencyGroupIdAndArtifactIdTest are @Disabled because they asserted on the classpath mutation performed by the download path:

  • updatesJavaSourceSetMarkerOnJavaFiles
  • composedWithChangePackageUpdatesImports

All other tests in :rewrite-maven pass unchanged, including:

  • JavaSourceSetUpdaterTest.typeCacheIsSharedAcrossUpdaters (checks cache sharing, not downloads)
  • javaSourceSetUnchangedWhenModuleDoesNotHaveDependency (negative assertion)
  • the graceful-failure test for a missing artifact

No Gradle tests reference JavaSourceSet / gavToTypes on the affected recipes, so nothing to disable there.

Short-circuit changeDependency and addDependency to return the source
set unchanged and make downloadAndScanTypes return an empty list. This
prevents MavenArtifactDownloader from being invoked during dependency
mutation recipes, eliminating the per-visitor artifact fetches that
multiplied outbound traffic during Spring Boot migrations.

Two tests in ChangeDependencyGroupIdAndArtifactIdTest are @disabled
because they asserted on classpath mutation performed by the download
path.
@github-project-automation github-project-automation Bot moved this to In Progress in OpenRewrite Apr 22, 2026
@steve-aom-elliott steve-aom-elliott moved this from In Progress to Ready to Review in OpenRewrite Apr 22, 2026
@sambsnyd sambsnyd merged commit 4ab7ed8 into main Apr 22, 2026
1 check passed
@sambsnyd sambsnyd deleted the fix/disable-javasourceset-jar-download branch April 22, 2026 22:00
@github-project-automation github-project-automation Bot moved this from Ready to Review to Done in OpenRewrite Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants