with one click
diagnose
// Use when a test fails and you need to diagnose the root cause. Run the test, read errors, trace through generated and source code, fix, and verify.
// Use when a test fails and you need to diagnose the root cause. Run the test, read errors, trace through generated and source code, fix, and verify.
| name | diagnose |
| description | Use when a test fails and you need to diagnose the root cause. Run the test, read errors, trace through generated and source code, fix, and verify. |
| allowed-tools | Bash(./mvnw:*), Bash(javap:*), Bash(unzip:*), Bash(grep:*) |
Systematic diagnosis of test failures in the Morphia project. Run the test, read the full error, trace the root cause through source and generated code, fix minimally, and verify.
Run the failing test
./mvnw test -pl :module-name -Dtest="ClassName#methodName" -Ddeploy.skip=true
-Ddeploy.skip=true to skip dokka-am with -Dtest= (applies test filter to all modules)./mvnw install -pl :dep1,:dep2 -DskipTests -Ddeploy.skip=true -Dinvoker.skip=true
Read the full error - stack trace, error message, line numbers. Don't skip anything.
Find relevant code - Read both source AND generated code:
src/main/, src/test/target/test-classes/ - use javap -c -p ClassName to decompiletarget/generated-sources/~/.m2/repository/ source jars with unzip -pTrace the root cause - Follow the error backward:
Fix minimally - One change at a time. Rebuild affected modules:
./mvnw install -pl :critter-core,:critter-maven -DskipTests -Ddeploy.skip=true -Dinvoker.skip=true
Verify - Re-run the failing test AND related tests in the same class.
| Error | Likely Cause |
|---|---|
AbstractMethodError | Missing bridge methods in generated bytecode (generic interface erasure) |
Cannot checkcast to primitive | Gizmo checkCast doesn't work on primitives - use smartCast |
Cannot convert primitive to Object | Need boxing: smartCast(result, wrapperType) |
NoSuchMethodError __read*/__write* | Accessor methods not generated on entity class |
ClassNotFoundException __morphia.* | Critter code generation didn't run or class not registered |
smartCastcheckCast(Object -> wrapper) then smartCast(wrapper -> primitive) for unboxingsmartCast(primitive -> wrapper) for boxingparser/gizmo/) and ASM (parser/asm/) generators for patterns