diagnose
- 作者仓库星标 1,680
- 许可证 Apache-2.0
- 作者仓库 morphia
Diagnose Test Failure
Overview
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.
Workflow
Run the failing test
./mvnw test -pl :module-name -Dtest="ClassName#methodName" -Ddeploy.skip=true- Use
-Ddeploy.skip=trueto skip dokka - Do NOT use
-amwith-Dtest=(applies test filter to all modules) - If dependencies need rebuilding first:
./mvnw install -pl :dep1,:dep2 -DskipTests -Ddeploy.skip=true -Dinvoker.skip=true
- Use
Read the full error - stack trace, error message, line numbers. Don't skip anything.
Find relevant code - Read both source AND generated code:
- Source:
src/main/,src/test/ - Generated bytecode:
target/test-classes/- usejavap -c -p ClassNameto decompile - Generated sources:
target/generated-sources/ - Interfaces from dependencies: check
~/.m2/repository/source jars withunzip -p
- Source:
Trace the root cause - Follow the error backward:
- What method is missing/wrong?
- What generated it? (Gizmo generator? ASM generator?)
- What does the interface/superclass require?
- Compare with working examples (ASM-based generators have bridge methods; check if Gizmo-based ones do too)
Fix minimally - One change at a time. Rebuild affected modules:
./mvnw install -pl :critter-core,:critter-maven -DskipTests -Ddeploy.skip=true -Dinvoker.skip=trueVerify - Re-run the failing test AND related tests in the same class.
Common Morphia/Critter Issues
| 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 |
Key Gotchas
- Gizmo does NOT auto-generate bridge methods for generic interfaces
- Primitive types need explicit boxing/unboxing via
smartCast checkCast(Object -> wrapper)thensmartCast(wrapper -> primitive)for unboxingsmartCast(primitive -> wrapper)for boxing- Always check both Gizmo (
parser/gizmo/) and ASM (parser/asm/) generators for patterns
- 流狐分类
- 工程开发
- 作者声明 Agent
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 94 / 100 · 启发式扫描,不代表运行安全
- 作者 / 版本 / 许可
- @MorphiaOrg · Apache-2.0
- 流狐 Token 估算
- 低消耗
- 流狐接入估算
- 即装即用
- 是否需要外部 API Key
- 未发现要求
- 检测到的系统要求
- macOS
- 底层运行要求
- 未声明
- 检测到的文件与系统行为
-
- 只读
- 允许写入 / 修改
- 检测到的网络行为
- 仅限本地
- 安装命令数
- 无(仅作为资料)
档案由构建时根据 SKILL.md 与安装命令自动衍生,可能与作者实际意图存在差异。
需要注意: 未限定 allowed-tools,默认拥有全部工具权限。
作者没有在当前 SKILL.md 中定义固定输出样例。 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 Use -Ddeploy.skip=true to skip dokka Do NOT use -am with -Dtest= (applies test filter to all modules)
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
Gizmo does NOT auto-generate bridge methods for generic interfaces Primitive types need explicit boxing/unboxing via smartCast checkCast(Object -> wrapper) then smartCast(wrapper -> primitive) for unboxing
# Diagnose Test Failure
## Overview
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.
## Workflow
1. **Run the failing test**
```
./mvnw test -pl :module-name -Dtest="ClassName#methodName" -Ddeploy.skip=true
```
- Use `-Ddeploy.skip=true` to skip dokka
- Do NOT use `-am` with `-Dtest=` (applies test filter to all modules)
- If dependencies need rebuilding first:
```
./mvnw install -pl :dep1,:dep2 -DskipTests -Ddeploy.skip=true -Dinvoker.skip=true
```
2. **Read the full error** - stack trace, error message, line numbers. Don't skip anything.
3. **Find relevant code** - Read both source AND generated code:
- Source: `src/main/`, `src/test/`
- Generated bytecode: `target/test-classes/` - use `javap -c -p ClassName` to decompile
- Generated sources: `target/generated-sources/`
- Interfaces from dependencies: check `~/.m2/repository/` source jars with `unzip -p`
4. **Trace the root cause** - Follow the error backward:
- What method is missing/wrong?
- What generated it? (Gizmo generator? ASM generator?)
- What does the interface/superclass require?
- Compare with working examples (ASM-based generators have bridge methods; check if Gizmo-based ones do too)
5. **Fix minimally** - One change at a time. Rebuild affected modules:
```
./mvnw install -pl :critter-core,:critter-maven -DskipTests -Ddeploy.skip=true -Dinvoker.skip=true
```
6. **Verify** - Re-run the failing test AND related tests in the same class.
## Common Morphia/Critter Issues
| Error | Likely Cause |
|-------|-------------|
… 作者原文负责流程事实;流狐只索引当前章节、要点、文件与命令。
章节 -> Overview → Workflow → Common Morphia/Critter Issues → Key Gotchas
要点 -> Run the failing test · Read the full error · Find relevant code · Trace the root cause · Fix minimally · Verify
文件/命令 -> -Ddeploy.skip=true · -am · -Dtest= · src/main/ · src/test/ · target/test-classes/ · javap -c -p ClassName · target/generated-sources/
内容 SHA-256 -> 7fbb6c65ec81
方法与流程
适用与边界
原文中的明确线索
-Ddeploy.skip=true、-am、-Dtest=、src/main/、src/test/、target/test-classes/、javap -c -p ClassName、target/generated-sources/