jdx usages
IDE equivalent: Find usages
Find usages of a type or member across the workspace's bytecode roots plus project source dirs: one row per referencing method (bytecode) or mentioning line (source dirs, ref kind). --kind narrows to call|read|write|ref|new|throw|annotation (default: all); new shows constructor <init> call sites, throw shows methods declaring the type in throws (declaration-level, not ATHROW throw sites), annotation shows annotated classes and members; source-dir hits are textual mentions (ref only), so call|read|write|new|throw|annotation show bytecode-backed edges alone. impl|override land with hierarchy (jdx hierarchy, jdx implementors). --in/--exclude filter by artifact label (jar file, JDK module or source-dir name). --src adds a source dir root (repeatable; stored via jdx ws create --src). Exits 1 when the symbol is unknown or unused, 2 on an ambiguous short name.
Usage#
jdx usages [<options>] <ref>Example#
jdx usages com.google.gson.JsonNull --limit 10 --coord com.google.code.gson:gson:2.14.0
usages of 'com.google.gson.JsonNull'
gson-2.14.0.jar (10)
read com.google.gson.Gson#toJson(java.lang.Object) -> #INSTANCE
read com.google.gson.Gson#toJson(java.lang.Object, java.lang.Appendable) -> #INSTANCE
read com.google.gson.Gson#toJsonTree(java.lang.Object) -> #INSTANCE
read com.google.gson.JsonArray#add(com.google.gson.JsonElement) -> #INSTANCE
read com.google.gson.JsonArray#add(java.lang.Boolean) -> #INSTANCE
read com.google.gson.JsonArray#add(java.lang.Character) -> #INSTANCE
read com.google.gson.JsonArray#add(java.lang.Number) -> #INSTANCE
read com.google.gson.JsonArray#add(java.lang.String) -> #INSTANCE
read com.google.gson.JsonArray#set(int, com.google.gson.JsonElement) -> #INSTANCE
ref com.google.gson.JsonElement#getAsJsonNull() -> com.google.gson.JsonNull
10 of 30 usages shown (--limit 30 to see more)
warning MULTI_RELEASE_VARIANT: multi-release gson-2.14.0.jar serves version-specific variants for this JDK (21)Real output — this example ran against the current jdx when the page was built.
Options#
| Option | Description |
|---|---|
--kind=(all|call|read|write|ref|impl|override|new|throw|annotation) | Edge kind: call, read, write, ref, new, throw, annotation or all (default all). throw = throws declarations, not ATHROW sites. impl|override land with hierarchy (jdx hierarchy, jdx implementors). |
--in=<text> | Only artifacts whose label matches this glob (jar file name, JDK module or source-dir name). |
--exclude=<text> | Skip artifacts whose label matches this glob. |
--limit=<int> | Maximum usages shown (default 50); the rest become a truncation footer. |
--context=<int> | Source lines around each call site (not supported: source-rendered call sites live in jdx samples). |
--jars=<text> | Binary roots: jar files, class directories or globs (repeatable). Merge in front of the selected workspace's roots. |
--src=<text> | Source-dir roots: directories of .java/.kt files scanned textually for whole-word mentions (ref kind, from <relpath>:<line>). Merge in front of the selected workspace's stored srcs. |
-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> | Type or member reference to find usages of (full or short form). |
Full help text#
Show jdx usages --help
jdx usages --help
Usage: jdx usages [<options>] <ref>
Find usages of a type or member across the workspace's bytecode roots plus project source dirs: one row per referencing method (bytecode) or mentioning line (source dirs, ref kind). --kind narrows to call|read|write|ref|new|throw|annotation (default: all); new shows constructor <init> call sites, throw shows methods declaring the type in throws (declaration-level, not ATHROW throw sites), annotation shows annotated classes and members; source-dir hits are textual mentions (ref only), so call|read|write|new|throw|annotation show bytecode-backed edges alone. impl|override land with hierarchy (jdx hierarchy, jdx implementors). --in/--exclude filter by artifact label (jar file, JDK module or source-dir name). --src adds a source dir root (repeatable; stored via jdx ws create --src). Exits 1 when the symbol is unknown or unused, 2 on an ambiguous short name.
Options:
--kind=(all|call|read|write|ref|impl|override|new|throw|annotation) Edge kind: call, read, write, ref, new, throw, annotation or all (default all). throw = throws declarations, not ATHROW sites. impl|override land with hierarchy (jdx hierarchy, jdx implementors).
--in=<text> Only artifacts whose label matches this glob (jar file name, JDK module or source-dir name).
--exclude=<text> Skip artifacts whose label matches this glob.
--limit=<int> Maximum usages shown (default 50); the rest become a truncation footer.
--context=<int> Source lines around each call site (not supported: source-rendered call sites live in jdx samples).
--jars=<text> Binary roots: jar files, class directories or globs (repeatable). Merge in front of the selected workspace's roots.
--src=<text> Source-dir roots: directories of .java/.kt files scanned textually for whole-word mentions (ref kind, from <relpath>:<line>). Merge in front of the selected workspace's stored srcs.
-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> Type or member reference to find usages of (full or short form).Real output — this example ran against the current jdx when the page was built.
Learn more#
Guide: Usages, hierarchy & calls · All commands