What happened
The error: AssertionError: An empty diff was generated. The recipe incorrectly changed a reference without changing its contents.
Affected downstream repos
All started failing on April 11, 2026 (were green on April 10):
- openrewrite/rewrite-hibernate —
MigrateToHibernate61Test.groupIdHibernateOrmRenamed()
- openrewrite/rewrite-migrate-java —
AddCommonAnnotationsDependenciesTest.changeAndUpgradeDependencyIfAnnotationJsr250Present()
- moderneinc/rewrite-dropwizard —
MigrateDropwizardToSpringBoot3Test.addsSpringStarterJdbcWhenDropwizardDbIsUsed()
Root cause
ChangeDependencyGroupIdAndArtifactId.getVisitor() now processes Java files (line 350-351) and calls updateJavaSourceSet(), which modifies the JavaSourceSet marker via JavaSourceSet.updateOnSourceFile(). This returns a new SourceFile object (different identity), causing the recipe framework to generate a Result. However, the printed text is unchanged — only markers differ — so RewriteTest flags it as an "empty diff" error.
The PR's own test (updatesJavaSourceSetMarkerOnJavaFiles) handles this by providing explicit after text identical to before. But downstream tests don't know about this new behavior.
Suggested fix
Consider one of:
-
Filter marker-only Results in InMemoryLargeSourceSet.getChangeset() — use Result.isLocalAndHasNoChanges() to skip Results where text is unchanged. This would need adjustment to the updatesJavaSourceSetMarkerOnJavaFiles test (use afterRecipe validation instead of after text matching).
-
Relax the "empty diff" check in RewriteTest — instead of failing when a Result has no text change and no after spec, silently ignore the Result. This is a less invasive change but reduces bug detection coverage.
-
Move marker updates out of the visitor phase — apply JavaSourceSet updates through a mechanism that doesn't generate Results (e.g., execution context sharing, or a post-processing step).
Workaround
Downstream repos can add explicit after text (identical to before) for Java source files in affected tests. PRs are being submitted for the affected repos.
What happened
ChangeDependencyGroupIdAndArtifactIdnow updatesJavaSourceSetmarkers on Java source files in itsgetVisitor()phase. This causes the test framework to detect "empty diff" errors in downstream repos where tests don't provide explicitaftertext for Java source files.The error:
AssertionError: An empty diff was generated. The recipe incorrectly changed a reference without changing its contents.Affected downstream repos
All started failing on April 11, 2026 (were green on April 10):
MigrateToHibernate61Test.groupIdHibernateOrmRenamed()AddCommonAnnotationsDependenciesTest.changeAndUpgradeDependencyIfAnnotationJsr250Present()MigrateDropwizardToSpringBoot3Test.addsSpringStarterJdbcWhenDropwizardDbIsUsed()Root cause
ChangeDependencyGroupIdAndArtifactId.getVisitor()now processes Java files (line 350-351) and callsupdateJavaSourceSet(), which modifies theJavaSourceSetmarker viaJavaSourceSet.updateOnSourceFile(). This returns a newSourceFileobject (different identity), causing the recipe framework to generate aResult. However, the printed text is unchanged — only markers differ — soRewriteTestflags it as an "empty diff" error.The PR's own test (
updatesJavaSourceSetMarkerOnJavaFiles) handles this by providing explicitaftertext identical tobefore. But downstream tests don't know about this new behavior.Suggested fix
Consider one of:
Filter marker-only Results in
InMemoryLargeSourceSet.getChangeset()— useResult.isLocalAndHasNoChanges()to skip Results where text is unchanged. This would need adjustment to theupdatesJavaSourceSetMarkerOnJavaFilestest (useafterRecipevalidation instead ofaftertext matching).Relax the "empty diff" check in
RewriteTest— instead of failing when a Result has no text change and noafterspec, silently ignore the Result. This is a less invasive change but reduces bug detection coverage.Move marker updates out of the visitor phase — apply JavaSourceSet updates through a mechanism that doesn't generate Results (e.g., execution context sharing, or a post-processing step).
Workaround
Downstream repos can add explicit
aftertext (identical tobefore) for Java source files in affected tests. PRs are being submitted for the affected repos.