analyze_method
Inspect a Java method at a file position to get signature, parameters, exceptions, callers, callees, and override info in one call, replacing separate method and call-hierarchy queries.
Instructions
Comprehensive method analysis in a single call.
USAGE: analyze_method(filePath="path/to/File.java", line=N, column=N) OUTPUT: Method info, parameters, exceptions, callers, callees, override info
Combines:
Method info (signature, modifiers, return type)
Parameters with types
Declared exceptions
Incoming calls (who calls this method)
Outgoing calls (what this method calls, in its lambdas included; a call in an anonymous or local class declared in it is a call of that class's member; creating an anonymous class is a call of the superclass constructor its constructor runs)
Override information (super method, overriding methods)
callers.count and callees.count are the exact numbers of distinct callers and callees; each list holds the first maxCallers (default 20) or maxCallees (default 50) of them, callers in search order and callees in source order. meta.totalCount counts both, meta.returnedCount those listed, and meta.truncated is true when either list is cut. A negative maxCallers or maxCallees is INVALID_PARAMETER.
The method is the one the position names, wherever it is declared: its file and line are those of its declaration, and its callees are read there. A method of a class file reports no file, line or callees (there is no source to read them from); its callers are those in the project's source files. callers.potentialMatches holds the references JDT could not confirm, the first maxCallers of them; overrides.potentialMatches the places naming the declaring type, or a subtype, as a supertype that JDT could not confirm. overrides.unresolvedSupertypes, present only when there are any, names each supertype of the declaring type the compiler cannot resolve, with the type whose declaration names it: the method may override a method of one of them.
Use this instead of multiple calls to get_method_at_position + call hierarchy tools.
IMPORTANT: Uses ZERO-BASED coordinates.
potentialMatches, present only when there are any, holds the places JDT's search reports as possible matches but cannot confirm, because a type or name there does not resolve (a missing dependency or a compile error): count is their exact number, and locations lists them, as many as the results it stands beside may list. They are never counted or listed as results.
Requires load_project to be called first.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| line | Yes | Zero-based line number | |
| column | Yes | Zero-based column number | |
| filePath | Yes | Path to source file | |
| maxCallees | No | Maximum callees listed (default 50); callees.count counts all | |
| maxCallers | No | Maximum callers listed (default 20); callers.count counts all |