Repository navigation
Conversation
manduinca
marked this pull request as ready for review
September 11, 2026 08:13
greg-at-moderne
self-requested a review
September 17, 2026 11:45
# Conflicts: # src/main/java/org/openrewrite/java/testing/junit5/MigrateJUnitTestCase.java
I keep constructor-call handling together with main's setName migration and its existing TestCase safeguards.
Contributor
Author
|
I've resolved the merge conflict, and all 26 focused recipe tests pass locally. The Java 25 CI job stops before compilation because downloading |
51 of 76 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fixes #1107.
I track redundant
TestCaseconstructors across source files, update simple constructor calls to the no-argument form, and propagate removal through subclass constructors. I preserve constructors where dropping arguments would discard side effects or invalidate constructor references.Details
super(...)andthis(...)chains, and update matchingnewexpressions.TestCase#run(TestResult). I also preserve overload sets when another constructor must remain.TestCase(String)constructor leaves the migrated test class unrunnable under JUnit 5 #1108.setNamemigration and existing TestCase safeguards from the earlier main merge (bc860019, October 23).Validation
I fixed the new accumulator validation failure by recording a small constructor summary during scanning instead of retaining
J.MethodDeclarationtrees. The summary keeps only the declaring type name, a body-safety flag, and an optional delegated-constructor signature.I reran all 26
MigrateJUnitTestCaseTesttests successfully. My related selection completed 64 tests: 62 passed, and the two Cucumber failures have the same names and failure messages as the comparison against mainbc860019recorded on October 23. This is a comparison with that earlier baseline, not a new run against main4506516b. I also rancheck -x test; license checks and recipe CSV validation passed.I reproduced the accumulator rejection in an external harness using the current official
AccumulatorContents,Tree, andHeavyweightsources without changes. Three scenarios fail on the previously published implementation (ed131437) with the same retainedJ.MethodDeclarationpath reported by Codegenome and pass with this fix. The scenarios cover a simple constructor, a cross-file hierarchy, and a constructor retained because its arguments have side effects. The harness checks the accumulator after scanning and after editing.The harness runs on the public Rewrite 8.90.4 runtime with an external compatibility overlay for the official
Tree/Heavyweightmarker and the two required helper methods extracted from the official sources. This is a focused reproduction of the accumulator validation, not the exact current Codegenome environment or a run of its full 2,285-test suite. The harness and overlay are outside the PR diff, and I have not disabled any validators.The standard
./gradlew buildstill stops during configuration because it cannot resolveorg.openrewrite.build.recipe-library:latest.releasethrough the declared repositories. For local validation I used Gradle 9.8.2, JDK 21, and the existing external, uncommitted init script selecting public build plugin 2.23.1, Rewrite 8.90.4, java-dependencies 1.60.2, static-analysis 2.41.1, error_prone_core 2.50.0, and cucumber-jvm 2.15.0. I have not changed the repository build configuration or test sources. The subsequent Codegenome build completed successfully (BUILD SUCCESSFUL in 8m 27s) for this commit merged into mainc13714ff.