Noir::JavaCalleeExtractor
Tree-sitter-backed Java 1-hop callee extractor. Parallels
Noir::PythonCalleeExtractor / Noir::GoCalleeExtractor for JVM
analyzers (Spring + framework-adapter siblings). Java's
method_invocation node carries the receiver in an object field
and the method name in a name field, so 1-hop extraction reduces
to:
- Find the (class_name, method_name)
method_declarationin the already-parsed root. - Walk its body for
method_invocation/method_referencenodes. - For each, reconstruct a textual callee:
foo()→fooservice.save(x)→service.savethis.foo()→this.fooFoo.bar()(static) →Foo.barMessage::body→Message.bodythis::toDto→this.toDtogetFoo().bar()→ "" (chained on a call — dropped as noise, mirroring the Python/Go chained-call filter)
Cross-file definition resolution (e.g. userService.save →
UserServiceImpl.save in another file) is intentionally out of
scope for this first cut. Callee#path therefore points at the
call site, matching the honest scope on every other analyzer.
Instance methods
Build a same-file method-name -> start row map. nil value marks
an ambiguous name (multiple method_declarations share it), so the
caller knows to keep the call site location instead of guessing
which overload to point at. Conservative by design — overloads,
qualified non-this calls, and missing declarations all stay at
call site.
Generic body walker for analyzers/extractors that already have the
handler method/lambda body node. Returns every 1-hop
method_invocation callee inside that body.
Lambda/handler entry point used by DSL analyzers (Javalin, Spark,
…) where the handler body is a lambda_expression's body — a
block or a single expression — not a method_declaration.
Caller is responsible for locating the body (the JVM lambda DSL
extractor already does this for parameter scanning) and passing
it in. Walks the body and returns every 1-hop method_invocation
callee.
Find the matching method_declaration in root and return every
1-hop method_invocation callee inside its body as
{name, file_path, file_line_1_based}. Empty array when the
method can't be located or its body is missing.