JavaFix — OpenClaw Plugin
Created by Riya Verma.
JavaFix is an OpenClaw plugin that diagnoses common Java compiler errors and runtime exceptions, explains them in plain language, and suggests concrete fixes with code examples.
Installation
npm install openclaw-javafix
Or add to your OpenClaw configuration:
{
"plugins": ["openclaw-javafix"]
}
Error Categories
JavaFix covers 26 errors across 11 categories:
| Category | Description |
|---|---|
type | Type mismatches, incompatible types |
null | NullPointerException and null-safety issues |
syntax | Missing braces, unclosed literals, bad syntax |
access | Static/non-static access, override errors |
generic | Generics-related issues |
cast | ClassCastException, unsafe casts |
import | Missing packages, ClassNotFoundException |
thread | Threading and concurrency issues |
io | I/O and stream-related errors |
collection | Array/list/string index errors, ConcurrentModificationException |
misc | StackOverflowError, OutOfMemoryError, etc. |
Agent Tools
JavaFix registers three tools for the OpenClaw agent:
java_fix
Paste raw javac compiler output or a JVM stack trace. JavaFix will parse it, identify every error, and return explanations with fix suggestions.
java_explain
Look up a specific error by its code (e.g. E-cannot-find-symbol, RT-NullPointerException) or a short description.
java_errors
List all known errors, optionally filtered by category.
Auto-Detection
JavaFix registers an after_tool_call hook that automatically detects Java errors in tool output. When patterns like error:, Exception in thread, or java.lang.*Exception appear, JavaFix will automatically provide diagnosis and fix suggestions.
CLI
JavaFix also registers a javafix CLI subcommand with three sub-commands:
# List all known errors
openclaw javafix errors
# List errors in a specific category
openclaw javafix errors type
# Look up a specific error
openclaw javafix lookup E-cannot-find-symbol
openclaw javafix lookup "cannot find symbol"
# List all categories
openclaw javafix categories
Testing
npm install
npm test
Tests are written with Vitest and cover:
- Error database — validates all 26 entries, field completeness, no duplicates, lookup by code/pattern/category
- Parser — validates parsing of javac output, stack traces, mixed output, edge cases
- Formatter — validates markdown output for single results, error lists, and multi-result formatting
License
MIT
