Stop Claude Code Interface Blindness: Hook Eclipse JDT LS via MCP for AST-Aware Java Refactoring
Claude Code is a beast in the terminal, but letting it raw-grep your enterprise Spring Boot codebase is a recipe for hallucinated method signatures and broken builds. If your AI agent doesn't understand the Abstract Syntax Tree (AST) of your decoupled interfaces, it is simply guessing.
Why Most Developers Get This Wrong
- Relying on grep-based search: Claude Code's default file search tools treat Java like raw text, completely missing runtime polymorphism and complex
@Qualifierannotations. - Ignoring the Model Context Protocol (MCP): Developers waste massive amounts of context window tokens pasting entire classes instead of letting Claude query a local language server.
- Assuming LLMs understand implicit Spring hierarchies: Claude 3.5 Sonnet cannot trace a
PaymentGatewayinterface to itsStripePaymentServiceImplimplementation across deep Gradle subprojects without semantic AST help.
The Right Way
Expose your local Eclipse JDT Language Server (JDT LS) to Claude Code using an MCP wrapper to enable precise, compiler-grade semantic searches.
- Spin up
eclipse.jdt.lsas a background daemon on your local development machine. - Configure Claude Code's
mcpConfig.jsonto route Java-specific queries likefind-implementationsdirectly to the JDT LS instance. - Force the agent to query the actual AST to resolve complex
@Autowiredbean hierarchies before generating refactoring diffs.
Want to go deeper? javalld.com — machine coding interview problems with working Java code and full execution traces.
Show Me The Code (or Example)
This mcpConfig.json configuration bridges Claude Code to your local JDT LS instance, giving the LLM direct access to Java's compiler APIs:
{
"mcpServers": {
"jdtls-ast-bridge": {
"command": "node",
"args": ["/usr/local/bin/jdtls-mcp-bridge.js"],
"env": {
"JDTLS_PATH": "/opt/eclipse.jdt.ls/plugins/org.eclipse.equinox.launcher_1.6.900.jar",
"WORKSPACE_DIR": "${userHome}/projects/enterprise-app"
}
}
}
}
Key Takeaways
- Stop treating Java like Python; compiler-centric languages require AST-aware LLM tools to prevent refactoring regressions.
- MCP is the bridge that turns Claude Code from a fast-typing intern into a staff-level engineer that respects your type system.
- Eliminate hallucinated method signatures by forcing Claude to verify method overrides against the actual JDT LS compilation unit before writing code.
Top comments (0)