Documentation menu

jdx annotated

IDE equivalent: Classes/members carrying an annotation (recipes: deprecated|forRemoval|test|bean)

List classes and members carrying an annotation (issue #26): equivalent to 'jdx usages <type> --kind annotation'. Query may be an annotation type, annotation-use spelling 'Type(k=v)' (omit leading @ on the CLI), or a recipe alias (deprecated, forRemoval, test, junit5, junit4, bean). --where key=value (repeatable) filters by element values (AND; string values may omit quotes). --in/--exclude filter by artifact label; --src adds source-dir roots; --context N shows a source window around each hit. Exits 1 when the annotation type is unknown or unused, 2 on an ambiguous short name.

Usage#

jdx annotated [<options>] <ref>

Example#

jdx annotated deprecated --limit 10 --coord com.google.code.gson:gson:2.14.0
usages of 'java.lang.Deprecated'
gson-2.14.0.jar (10)
  annotation com.google.gson.Gson#excluder()  @java.lang.Deprecated -> java.lang.Deprecated
  annotation com.google.gson.GsonBuilder#setDateFormat(int)  @java.lang.Deprecated -> java.lang.Deprecated
  annotation com.google.gson.GsonBuilder#setLenient()  @java.lang.Deprecated -> java.lang.Deprecated
  annotation com.google.gson.JsonArray#getAsCharacter()  @java.lang.Deprecated -> java.lang.Deprecated
  annotation com.google.gson.JsonElement#<init>()  @java.lang.Deprecated -> java.lang.Deprecated
  annotation com.google.gson.JsonElement#getAsCharacter()  @java.lang.Deprecated -> java.lang.Deprecated
  annotation com.google.gson.JsonNull#<init>()  @java.lang.Deprecated -> java.lang.Deprecated
  annotation com.google.gson.JsonParser#<init>()  @java.lang.Deprecated -> java.lang.Deprecated
  annotation com.google.gson.JsonParser#parse(com.google.gson.stream.JsonReader)  @java.lang.Deprecated -> java.lang.Deprecated
  annotation com.google.gson.JsonParser#parse(java.io.Reader)  @java.lang.Deprecated -> java.lang.Deprecated
10 of 1172 usages shown (--limit 1172 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#

OptionDescription
--where=<text>Annotation value predicate key=value (repeatable, AND). String values may omit surrounding quotes (--where since=99 matches since="99"). Dotted keys walk nested annotations (--where nested.k=1); {…} arrays match order-insensitively. Equivalent inline form: jdx annotated 'Type(k=v)'.
--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 hits shown (default 50); the rest become a truncation footer.
--context=<int>Source lines around each hit (0 = location only; N slices paired sources / --src files around the LineNumberTable line, capped at 15).
--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 (repeatable; stored via jdx ws create --src).
-w, --workspace=<text>Use a named workspace (see jdx ws). Explicit --jars merge in front of it.
--no-jdkDo 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.
--fetchAllow 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.
--jsonEmit machine-readable JSON instead of human-readable text (same information, D-007).
--no-colorDisable ANSI colors even on a TTY (piped output is always plain).
--no-daemonForce in-process execution: do not forward this query to the background daemon even when its socket answers (PROPOSAL.md §14.1).
-h, --helpShow this message and exit

Arguments#

ArgumentDescription
<ref>Annotation type, 'Type(k=v)' use spelling (omit leading @), or recipe alias (deprecated|forRemoval|test|junit5|junit4|bean).

Full help text#

Show jdx annotated --help
jdx annotated --help
Usage: jdx annotated [<options>] <ref>

  List classes and members carrying an annotation (issue #26): equivalent to 'jdx usages <type> --kind annotation'. Query may be an annotation type, annotation-use spelling 'Type(k=v)' (omit leading @ on the CLI), or a recipe alias (deprecated, forRemoval, test, junit5, junit4, bean). --where key=value (repeatable) filters by element values (AND; string values may omit quotes). --in/--exclude filter by artifact label; --src adds source-dir roots; --context N shows a source window around each hit. Exits 1 when the annotation type is unknown or unused, 2 on an ambiguous short name.

Options:
  --where=<text>          Annotation value predicate key=value (repeatable, AND). String values may omit surrounding quotes (--where since=99 matches since="99"). Dotted keys walk nested annotations (--where nested.k=1); {…} arrays match order-insensitively. Equivalent inline form: jdx annotated 'Type(k=v)'.
  --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 hits shown (default 50); the rest become a truncation footer.
  --context=<int>         Source lines around each hit (0 = location only; N slices paired sources / --src files around the LineNumberTable line, capped at 15).
  --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 (repeatable; stored via jdx ws create --src).
  -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>  Annotation type, 'Type(k=v)' use spelling (omit leading @), or recipe alias (deprecated|forRemoval|test|junit5|junit4|bean).

Real output — this example ran against the current jdx when the page was built.

Learn more#

Guide: Usages, hierarchy & calls · All commands

View as Markdown · Updated