Skip to content

Reading Source

Danny Thomas edited this page Sep 18, 2026 · 1 revision

Use -s or --source to choose how much source to show:

Scope Output
none Compiled declaration without reading source
body Attached-source lines named by a compiled method's line-number table
signature Literal source declaration header (default)
doc Associated Javadoc through the end of the declaration header
definition Associated Javadoc and the complete declaration
symbol Source appropriate to the selected symbol
type Complete outermost top-level type and its Javadoc
unit Complete attached source file

For example, show the Javadoc and implementation of String.length():

$ jist --source definition java.lang.String.length
java.lang.String(String.java:1574):     /**
java.lang.String(String.java:1575):      * Returns the length of this string.
java.lang.String(String.java:1576):      *
java.lang.String(String.java:1581):      */
java.lang.String(String.java:1582):     public int length() {
java.lang.String(String.java:1583):         return value.length >> coder();
java.lang.String(String.java:1584):     }

symbol emits the complete compilation unit for a top-level type, the complete declaration for a nested type or executable, and the signature for other symbols.

body uses the selected methods' ClassFile line-number tables. It can therefore show attached non-Java source, such as Kotlin, without trying to infer language-specific declaration boundaries. Abstract or native methods and ClassFiles without line-number tables fall back to compiled declarations. unit also supports complete attached non-Java source files.

Missing requested source produces one warning per compilation unit on standard error and deterministic ClassFile output. Use --source none when compiled declarations are intended. Compiler-generated Kotlin metadata annotations are omitted from Java-shaped declarations, while ordinary declaration annotations and values are retained.

Clone this wiki locally