fix: use direct Processor API for rename, ensure checkFinalConditions runs (#26) #38

Merged
fred merged 1 commit from fix/26-rename-processor-api into main 2026-03-08 09:37:19 +00:00
Collaborator

Summary

Fixes #26jdt_rename_element reports SUCCESS but changes nothing (silent no-op).

Root cause: The fix chain #20→#22→#24 treated symptoms but skipped checkFinalConditions(), which is where the RenameProcessor searches references and computes TextEdits. Without it, createChange() produces an empty CompositeChange (childCount:0).

Changes

  • Direct Processor API instead of Descriptor API — RenameFieldProcessor, RenameTypeProcessor, RenameVirtualMethodProcessor / RenameNonVirtualMethodProcessor (same pattern already used for ChangeSignatureProcessor)
  • Separate checkInitialConditions + checkFinalConditions — if checkFinalConditions throws IAE (headless preferences), initialize preferences and retry with fresh refactoring instead of skipping it entirely
  • Virtual vs non-virtual method detection — uses MethodChecks.isVirtual() to pick correct processor (#29)
  • childCount:0 = ERROR instead of WARNING — don't perform empty changes (#34)
  • Removed: ensureParticipantsInitialized reflection hack (#31), getRefactoringId, hasParticipantErrors, createAndCheckRefactoring

Analysis

Three specialized JDT expert agents (Gamma/Vogel/Duft) independently confirmed the same root cause. See #26 comments for test plan.

Test plan

  • Build: mvn clean package passes
  • Smoke tests: tests/smoke-test.sh passes
  • Manual test: rename field in single-module project
  • Manual test: rename interface constant cross-module (VocabCg#CACHED_AT scenario from #26)
  • Verify: rename reports actual childCount > 0, files are modified
  • Verify: IAE retry path works (if preferences not initialized)

🤖 Generated with Claude Code

## Summary Fixes #26 — `jdt_rename_element` reports SUCCESS but changes nothing (silent no-op). **Root cause:** The fix chain #20→#22→#24 treated symptoms but skipped `checkFinalConditions()`, which is where the RenameProcessor searches references and computes TextEdits. Without it, `createChange()` produces an empty CompositeChange (childCount:0). ### Changes - **Direct Processor API** instead of Descriptor API — `RenameFieldProcessor`, `RenameTypeProcessor`, `RenameVirtualMethodProcessor` / `RenameNonVirtualMethodProcessor` (same pattern already used for `ChangeSignatureProcessor`) - **Separate `checkInitialConditions` + `checkFinalConditions`** — if `checkFinalConditions` throws IAE (headless preferences), initialize preferences and retry with fresh refactoring instead of skipping it entirely - **Virtual vs non-virtual method detection** — uses `MethodChecks.isVirtual()` to pick correct processor (#29) - **childCount:0 = ERROR** instead of WARNING — don't perform empty changes (#34) - **Removed:** `ensureParticipantsInitialized` reflection hack (#31), `getRefactoringId`, `hasParticipantErrors`, `createAndCheckRefactoring` ### Analysis Three specialized JDT expert agents (Gamma/Vogel/Duft) independently confirmed the same root cause. See #26 comments for test plan. ## Test plan - [ ] Build: `mvn clean package` passes - [ ] Smoke tests: `tests/smoke-test.sh` passes - [ ] Manual test: rename field in single-module project - [ ] Manual test: rename interface constant cross-module (VocabCg#CACHED_AT scenario from #26) - [ ] Verify: rename reports actual childCount > 0, files are modified - [ ] Verify: IAE retry path works (if preferences not initialized) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fix: use direct Processor API for rename, ensure checkFinalConditions runs (#26)
All checks were successful
Build and Release / build (push) Successful in 3m50s
40afa10025
Root cause: checkFinalConditions() was skipped on IAE, producing empty
Changes (childCount:0). The fix chain #20→#22→#24 treated symptoms
but never addressed the core issue.

Changes:
- Replace Descriptor API with direct RenameFieldProcessor/RenameTypeProcessor/
  RenameMethodProcessor (same pattern as ChangeSignatureProcessor)
- Call checkInitialConditions + checkFinalConditions separately instead of
  checkAllConditions, so IAE in final conditions can be retried
- Initialize headless preferences on IAE and retry with fresh refactoring
- Distinguish virtual vs non-virtual methods (RenameVirtualMethodProcessor)
- Treat childCount:0 as ERROR instead of WARNING
- Remove reflection hack (ensureParticipantsInitialized)
- Remove unused getRefactoringId, hasParticipantErrors, createAndCheckRefactoring

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
fred merged commit 40afa10025 into main 2026-03-08 09:37:19 +00:00
fred deleted branch fix/26-rename-processor-api 2026-03-08 09:37:20 +00:00
Sign in to join this conversation.
No description provided.