# jdx calls

IDE equivalent: Call hierarchy (out)

Show what a method calls, transitively to --depth (default 1): one indented row per callee, cycle-safe with …(cycle) markers. --in/--exclude filter rows by artifact label; --external-only prunes callees in the method's own artifact. Member refs only (methods + constructors); type refs and field refs exit 3. Exits 1 when the method is unknown or calls nothing, 2 on an ambiguous short name.

## Usage

```text
jdx calls [<options>] <ref>
```

## Example

```console
$ jdx calls 'com.google.gson.Gson#toJson(java.lang.Object)' --coord com.google.code.gson:gson:2.14.0
calls from 'com.google.gson.Gson#toJson(java.lang.Object)'
  call com.google.gson.Gson#toJson(com.google.gson.JsonElement)  gson-2.14.0.jar
  call com.google.gson.Gson#toJson(java.lang.Object, java.lang.reflect.Type)  gson-2.14.0.jar
  call java.lang.Object#getClass()  java.base
warning MULTI_RELEASE_VARIANT: multi-release gson-2.14.0.jar serves version-specific variants for this JDK (21)
```

## Options

| Option | Description |
|---|---|
| `--depth=<int>` | Maximum transitive levels shown (default 1, direct callees only). |
| `--in=<text>` | Only callees whose artifact label matches this glob (jar file name, JDK module or class-dir name). |
| `--exclude=<text>` | Skip callees whose artifact label matches this glob. |
| `--external-only` | Hide callees in the queried method's own artifact (dependency view). |
| `--limit=<int>` | Maximum tree nodes shown (default 50); the rest become a truncation footer. |
| `--jars=<text>` | Binary roots: jar files, class directories or globs (repeatable). Merge in front of the selected workspace's roots. |
| `-w, --workspace=<text>` | Use a named workspace (see jdx ws). Explicit --jars merge in front of it. |
| `--no-jdk` | Do not include the running JDK's stdlib (included by default). |
| `--coord=<text>` | Maven coordinate root group:artifact:version (repeatable). Resolved from ~/.gradle/caches and ~/.m2 first; with --fetch, downloaded from Maven repositories into <cache-dir>/m2 with checksum verification. Merges in front of the workspace. |
| `--repo=<text>` | Maven repository base URL for --coord fetches (repeatable, e.g. --repo https://repo.example.com/maven2). Tried in flag order before Maven Central, which stays last as the fallback. Must be an http(s) URL. |
| `--fetch` | Allow downloading --coord artifacts (and their -sources.jar) from Maven repositories (Central by default, --repo to add mirrors). Without it, coordinates resolve from the local caches only. |
| `--json` | Emit machine-readable JSON instead of human-readable text (same information, D-007). |
| `--no-color` | Disable ANSI colors even on a TTY (piped output is always plain). |
| `--no-daemon` | Force in-process execution: do not forward this query to the background daemon even when its socket answers (PROPOSAL.md §14.1). |
| `-h, --help` | Show this message and exit |

## Arguments

| Argument | Description |
|---|---|
| `<ref>` | Method or constructor reference to list callees of (full or short form). |

## Full help text

```console
$ jdx calls --help
Usage: jdx calls [<options>] <ref>

  Show what a method calls, transitively to --depth (default 1): one indented row per callee, cycle-safe with …(cycle) markers. --in/--exclude filter rows by artifact label; --external-only prunes callees in the method's own artifact. Member refs only (methods + constructors); type refs and field refs exit 3. Exits 1 when the method is unknown or calls nothing, 2 on an ambiguous short name.

Options:
  --depth=<int>           Maximum transitive levels shown (default 1, direct callees only).
  --in=<text>             Only callees whose artifact label matches this glob (jar file name, JDK module or class-dir name).
  --exclude=<text>        Skip callees whose artifact label matches this glob.
  --external-only         Hide callees in the queried method's own artifact (dependency view).
  --limit=<int>           Maximum tree nodes shown (default 50); the rest become a truncation footer.
  --jars=<text>           Binary roots: jar files, class directories or globs (repeatable). Merge in front of the selected workspace's roots.
  -w, --workspace=<text>  Use a named workspace (see jdx ws). Explicit --jars merge in front of it.
  --no-jdk                Do not include the running JDK's stdlib (included by default).
  --coord=<text>          Maven coordinate root group:artifact:version (repeatable). Resolved from ~/.gradle/caches and ~/.m2 first; with --fetch, downloaded from Maven repositories into <cache-dir>/m2 with checksum verification. Merges in front of the workspace.
  --repo=<text>           Maven repository base URL for --coord fetches (repeatable, e.g. --repo https://repo.example.com/maven2). Tried in flag order before Maven Central, which stays last as the fallback. Must be an http(s) URL.
  --fetch                 Allow downloading --coord artifacts (and their -sources.jar) from Maven repositories (Central by default, --repo to add mirrors). Without it, coordinates resolve from the local caches only.
  --json                  Emit machine-readable JSON instead of human-readable text (same information, D-007).
  --no-color              Disable ANSI colors even on a TTY (piped output is always plain).
  --no-daemon             Force in-process execution: do not forward this query to the background daemon even when its socket answers (PROPOSAL.md §14.1).
  -h, --help              Show this message and exit

Arguments:
  <ref>  Method or constructor reference to list callees of (full or short form).
```

## Learn more

Guide: [Usages, hierarchy & calls](https://mohammadmd1383.github.io/jdx/docs/navigating-code/) · [All commands](https://mohammadmd1383.github.io/jdx/docs/reference/)
