PROBLEM
The Java backends' entity lookups fall off the end of the function on a miss — implicit None under non-Optional annotations (-> JCallable, -> JType) — and the first dereference turns a benign miss into a crash: get_method_parameters raises AttributeError: 'NoneType' object has no attribute 'parameters' for any typo'd class or signature. Seven internal call sites dereference get_method results unchecked.
AFFECTED CODE (audit classes C1-C3)
- cldk/analysis/java/codeanalyzer/codeanalyzer.py:475 —
get_method implicit None, annotated -> JCallable; same file get_class, get_java_file share the pattern - cldk/analysis/java/codeanalyzer/codeanalyzer.py:503 —
get_method_parameters crashes on miss - cldk/analysis/java/codeanalyzer/codeanalyzer.py:738, :741, :769, :775, :808, :846, :1083 — unguarded internal consumers (symbol-table call-graph paths, latent crashes)
- cldk/analysis/java/neo4j/neo4j_backend.py:461, :472 — same
get_method / get_method_parameters pair on the Neo4j backend; get_java_file implicit None too
FIX CONTRACT
- Honest annotations:
get_method/get_class/get_java_file (both backends) return Optional[...] with explicit return None. get_method_parameters returns [] on miss (consistent with the Python/TS backends' documented behavior) instead of crashing.- Guard the internal consumers: a miss mid-call-graph-construction must not raise AttributeError (skip the entry; existing behavior for found entries unchanged).
- NO behavior change on hits; no signature changes beyond Optional annotations. Miss-shape semantics of get_all_callers/get_all_callees (bare
{}, audit class C4) are explicitly OUT of scope — that is the 2.0.0 batch issue.
DEFINITION OF DONE
- Failing tests first: miss on
get_method_parameters returns [] (no crash), get_method miss returns None under Optional annotation, on both backends. - Existing tests green; mypy/annotation check passes on the touched files.
- Branch fix/issue-NNN; one PR closes this.
Found in the 2026-07-09 lookup audit (see #238 discussion; F1 oracle note on #239).
PROBLEM
The Java backends' entity lookups fall off the end of the function on a miss — implicit
Noneunder non-Optional annotations (-> JCallable,-> JType) — and the first dereference turns a benign miss into a crash:get_method_parametersraisesAttributeError: 'NoneType' object has no attribute 'parameters'for any typo'd class or signature. Seven internal call sites dereferenceget_methodresults unchecked.AFFECTED CODE (audit classes C1-C3)
get_methodimplicit None, annotated-> JCallable; same fileget_class,get_java_fileshare the patternget_method_parameterscrashes on missget_method/get_method_parameterspair on the Neo4j backend;get_java_fileimplicit None tooFIX CONTRACT
get_method/get_class/get_java_file(both backends) returnOptional[...]with explicitreturn None.get_method_parametersreturns[]on miss (consistent with the Python/TS backends' documented behavior) instead of crashing.{}, audit class C4) are explicitly OUT of scope — that is the 2.0.0 batch issue.DEFINITION OF DONE
get_method_parametersreturns[](no crash),get_methodmiss returns None under Optional annotation, on both backends.Found in the 2026-07-09 lookup audit (see #238 discussion; F1 oracle note on #239).