fix: rename updates references across multi-module workspace (#15) #17

Merged
fred merged 1 commit from fix/15-rename-cross-module-references into main 2026-03-07 14:02:41 +00:00
Collaborator

Summary

Fixes #15jdt_rename_element now correctly updates references across multi-module Maven workspaces.

Root Cause

JDT's RefactoringScopeFactory uses IProject.getReferencingProjects() (Eclipse project references from .project) to determine the rename search scope — not the classpath entries. Without Eclipse project references, the rename processor only modified the declaration file, reporting SUCCESS with childCount: 0.

Changes

  • ProjectImporter: After importing Maven multi-module projects, set up both:
    • JavaCore.newProjectEntry() — for classpath resolution (type lookup, compilation)
    • IProjectDescription.setReferencedProjects() — for refactoring scope (rename, move)
  • ProjectImporter: Re-wire dependencies when importing additional projects later (cross-repo workspaces)
  • RefactoringTools: Filter harmless participant errors in headless mode (Launch/Breakpoint/Watchpoint participants fail without Eclipse debug UI) with automatic retry
  • RefactoringTools: Return WARNING status when rename produces no reference updates (childCount == 0) instead of misleading SUCCESS
  • RefactoringTools: Capture change description before perform() for accurate reporting

Tests

New tests/multi-module-test.sh with 5 integration tests:

  1. Inter-project dependency setup (classpath)
  2. Cross-module type resolution
  3. Cross-module reference finding
  4. Cross-module rename with reference updates
  5. File content verification after rename

All 14 tests pass (9 smoke + 5 multi-module).

## Summary Fixes #15 — `jdt_rename_element` now correctly updates references across multi-module Maven workspaces. ### Root Cause JDT's `RefactoringScopeFactory` uses `IProject.getReferencingProjects()` (Eclipse project references from `.project`) to determine the rename search scope — **not** the classpath entries. Without Eclipse project references, the rename processor only modified the declaration file, reporting `SUCCESS` with `childCount: 0`. ### Changes - **ProjectImporter**: After importing Maven multi-module projects, set up both: - `JavaCore.newProjectEntry()` — for classpath resolution (type lookup, compilation) - `IProjectDescription.setReferencedProjects()` — for refactoring scope (rename, move) - **ProjectImporter**: Re-wire dependencies when importing additional projects later (cross-repo workspaces) - **RefactoringTools**: Filter harmless participant errors in headless mode (Launch/Breakpoint/Watchpoint participants fail without Eclipse debug UI) with automatic retry - **RefactoringTools**: Return `WARNING` status when rename produces no reference updates (`childCount == 0`) instead of misleading `SUCCESS` - **RefactoringTools**: Capture change description before `perform()` for accurate reporting ### Tests New `tests/multi-module-test.sh` with 5 integration tests: 1. Inter-project dependency setup (classpath) 2. Cross-module type resolution 3. Cross-module reference finding 4. Cross-module rename with reference updates 5. File content verification after rename All 14 tests pass (9 smoke + 5 multi-module).
fix: rename updates references across multi-module workspace (#15)
All checks were successful
Build and Release / build (push) Successful in 3m32s
ca44ad9ae1
Root cause: JDT's RefactoringScopeFactory uses IProject.getReferencingProjects()
(Eclipse project references) to determine rename scope, not classpath entries.
Without project references, the rename processor only modified the declaration
file, reporting SUCCESS with childCount=0.

Changes:
- ProjectImporter: set up inter-project dependencies after importing Maven
  multi-module projects (both classpath entries AND Eclipse project references)
- ProjectImporter: re-wire dependencies when importing additional projects
  (cross-repo scenarios)
- RefactoringTools: filter harmless participant errors in headless mode
  (Launch/Breakpoint/Watchpoint participants) with automatic retry
- RefactoringTools: warn when rename produces no reference updates
- RefactoringTools: capture change description before perform()

Tests:
- New multi-module-test.sh with 5 tests covering inter-project dependency
  setup, cross-module type resolution, reference finding, and rename

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
fred merged commit ca44ad9ae1 into main 2026-03-07 14:02:41 +00:00
fred deleted branch fix/15-rename-cross-module-references 2026-03-07 14:02:41 +00:00
Sign in to join this conversation.
No description provided.