openrewrite / openrewrite/rewrite
Inconsistent insertion order for `addMethodDeclaration`
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 3.7k
- Forks
- 570
- Avg merge
- 13h 12m
- Merged PRs (30d)
- 261
Description
When using .addMethodDeclaration(Comparator.comparing(J.MethodDeclaration::getSimpleName)) , it does not seem to consistently place the new MethodDeclaration in the same place, resulting in unit tests intermittently failing.
Example in a previous PR, where I resorted to switching to use .firstStatement to pass unit tests consistently.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the addMethodDeclaration entry point and reproduce the inconsistent placement using Comparator.comparing(J.MethodDeclaration::getSimpleName). Review the previous PR discussion linked in the issue for context. Done means the new MethodDeclaration is inserted consistently and the affected unit tests no longer fail intermittently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100