Extending a Refaster Rule in Picnic's error-prone-support and Recovering a Broken PR
Description and use
Added a Refaster rule to replace Optional.of().orElse() with requireNonNull(), recovered a broken PR on GitHub, and merged the change.
Problem
Add a Refaster rule to replace Optional.of().orElse() with requireNonNull() and handle a PR that became stuck in a broken state on GitHub.
Outcome
The new Refaster rule was successfully merged, improving code clarity by replacing redundant Optional usage. The PR recovery process demonstrated how to handle GitHub’s broken PR state by recreating the PR from the same branch.
Workflow
- 1. Reviewed existing RequireNonNullExpression rule and identified missing Optional.of().orElse() pattern.
- 2. Implemented new Refaster rule to rewrite Optional.of(value).orElse(fallback) to requireNonNull(value).
- 3. Created PR #2264 with the new rule and Javadoc changes.
- 4. PR entered a broken state; contacted GitHub Support and learned it required recreating the PR.
- 5. Created new PR #2275 from the same branch, linked to #2264, and added maintainer‑suggested Javadoc wording.
- 6. Reviewed feedback: removed duplicate reference to OptionalOfRedundantMethod, ran full test suite (78 tests, 0 failures), adjusted Javadoc style, and remained patient during review.
- 7. PR approved and merged.
- 8. Documented lessons learned and shared proof of work via public links.
Evidence
The project already had a rule called RequireNonNullExpression. I extended it to cover this pattern: ...
My first PR, #2264, got into a strange state after an accidental close. The page showed "Merge status cannot be loaded", and the Reopen button was disabled.
I opened #2275 with the exact same commits, plus the Javadoc wording a maintainer had suggested, and linked it back to the original.
The PR was approved and merged by the maintainers.
- Record date: 2026-11-04T05:14:18.938Z