fix: catch IllegalArgumentException in field rename headless mode (#22) #23

Merged
fred merged 2 commits from feature/version-tool into main 2026-03-07 16:53:37 +00:00
Collaborator

Summary

  • Fixes #22: jdt_rename_element with FIELD still throws IllegalArgumentException despite the fix from #21
  • The root cause: setRenameGetters/Setters(false) only prevents co-renaming, but Eclipse still calls GetterSetterUtil.getSetterName internally during checkAllConditions(), which fails via ProjectScope.getNode() in headless mode
  • Now catches the IllegalArgumentException for field renames, creates a fresh refactoring instance, and falls back to checkInitialConditions only (skipping the getter/setter name resolution code path)

Test plan

  • Field rename with preview=true no longer throws IllegalArgumentException
  • Field rename with preview=false applies correctly
  • Non-field renames (CLASS, METHOD) still work as before
  • IllegalArgumentException for non-field renames is still propagated

🤖 Generated with Claude Code

## Summary - Fixes #22: `jdt_rename_element` with `FIELD` still throws `IllegalArgumentException` despite the fix from #21 - The root cause: `setRenameGetters/Setters(false)` only prevents co-renaming, but Eclipse still calls `GetterSetterUtil.getSetterName` internally during `checkAllConditions()`, which fails via `ProjectScope.getNode()` in headless mode - Now catches the `IllegalArgumentException` for field renames, creates a fresh refactoring instance, and falls back to `checkInitialConditions` only (skipping the getter/setter name resolution code path) ## Test plan - [ ] Field rename with `preview=true` no longer throws `IllegalArgumentException` - [ ] Field rename with `preview=false` applies correctly - [ ] Non-field renames (CLASS, METHOD) still work as before - [ ] `IllegalArgumentException` for non-field renames is still propagated 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Replace hardcoded SERVER_VERSION with VersionInfo that reads the
.version file from the installation directory (written by CI from
git tag). Add jdt_get_version MCP tool to expose version at runtime.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
fix: catch IllegalArgumentException in field rename headless mode (#22)
All checks were successful
Build and Release / build (push) Successful in 3m51s
48f1c9a832
The fix from #21 (setRenameGetters/Setters false) only prevents
co-renaming but Eclipse still calls GetterSetterUtil.getSetterName
internally during checkAllConditions, which fails via
ProjectScope.getNode() in headless mode.

Now catches the IAE for field renames, creates a fresh refactoring
(old one may be corrupted), and falls back to checkInitialConditions
only — which skips the getter/setter name resolution code path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
fred merged commit 48f1c9a832 into main 2026-03-07 16:53:37 +00:00
fred deleted branch feature/version-tool 2026-03-07 16:53:37 +00:00
Sign in to join this conversation.
No description provided.