You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(java): implicit-None lookups under non-Optional annotations; get_method_parameters crashes on miss #248
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/neo4j/neo4j_backend.py:461, :472 — same get_method / get_method_parameters pair on the Neo4j backend; get_java_file implicit None too
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).
Activity
fix(java): honest Optional lookups; no crash on miss (#252)