fix: AST-based rename fallback for interface fields (#39) #40
No reviewers
Labels
No labels
bug
build
enhancement
headless
P1-critical
P2-high
P3-medium
P4-low
refactoring
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ai-tools/jdt-mcp-server!40
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/39-ast-rename-fallback"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fixes #39 —
jdt_rename_elementthrows NPE in v0.2.17 when renaming interface fields.Root cause:
RenameFieldProcessor.checkFinalConditions()throwsIllegalArgumentException(without message!) for interface fields (public static finalin an interface). The preference initialization retry from #38 was a false lead — the IAE is not about preferences.Changes
SearchEngine+ASTRewrite— works reliably in headless mode without Participants or PreferencescheckFinalConditionsthrows IAE → AST fallbackinitializeHeadlessPreferences()List.of(null)when IAE has no messageHow the AST fallback works
SearchEngine.search()finds all references (workspace scope, accurate matches only)ASTRewriterenames the declaration viaNodeFinder+SimpleNamereplacementAnalysis
Agent jdt-vogel (Lars Vogel) confirmed: the IAE is specific to interface fields, not a preferences issue. AST-based rename is the recommended approach for headless mode.
Test plan
mvn clean packagepassesJDTMCP_SKIP_BUILD=1 ./install-local.shsucceeds🤖 Generated with Claude Code