Skip to content

Symbol table schema

The symbol_table is the always-present structural model of the program. It is a map from absolute file path to a compilation unit (one .java file). Everything below is serialized in snake_case (see serialization conventions); field types are shown in TypeScript-ish notation for clarity.

{
"symbol_table": {
"/abs/path/to/Foo.java": { /* JavaCompilationUnit */ }
}
}

A single .java source file.

{
file_path: string // Absolute path
package_name: string // Package declaration
comments: JComment[] // File-level comments
imports: JImport[] // Import declarations
type_declarations: { // Top-level types in this file
[typeName: string]: JType
}
is_modified?: boolean // Set on incremental updates
}

The is_modified flag is set when a file is re-analyzed through incremental target-file analysis.

A class, interface, enum, annotation, or record.

{
is_class_or_interface_declaration: boolean
is_enum_declaration: boolean
is_annotation_declaration: boolean
is_record_declaration: boolean
is_interface: boolean
is_nested_type: boolean
is_inner_class: boolean
is_local_class: boolean
modifiers: string[] // "public", "abstract", ...
annotations: string[] // "@Deprecated", ...
extends_list: string[] // Superclass name(s), qualified
implements_list: string[] // Implemented interface names
parent_type: string | null // For nested / inner types
nested_type_declarations: string[] // Names of nested types
field_declarations: JField[]
callable_declarations: { // Methods + constructors
[signature: string]: JCallable
}
enum_constants: JEnumConstant[] // Enum members
record_components: JRecordComponent[] // Record components
initialization_blocks: JInitializationBlock[]
comments: JComment[]
is_entrypoint_class: boolean // true for main(String[]) classes
}

The boolean discriminators (is_enum_declaration, is_record_declaration, …) tell you which kind of type this is. See Entry points for is_entrypoint_class.

A method or constructor. Keyed in callable_declarations by its signature.

{
signature: string // "methodName(Type1, Type2)"
declaration: string // Full declaration with modifiers
modifiers: string[] // "public", "static", "final", ...
annotations: string[]
return_type: string | null // null for constructors
thrown_exceptions: string[]
parameters: JParameter[] // Declared parameters
comments: JComment[]
code: string // Method body source
file_path: string
start_line: number // Span in source
end_line: number
code_start_line: number // Where the body begins
call_sites: JCallSite[] // Calls made inside this method
referenced_types: string[] // Types referenced in the body
accessed_fields: string[] // Fields read or written
variable_declarations: JVariableDeclaration[]
crud_operations: JCRUDOperation[] // Detected DB operations
crud_queries: JCRUDQuery[] // Detected query definitions
cyclomatic_complexity: number
is_constructor: boolean
is_implicit: boolean // Synthesized (e.g. default ctor)
is_entrypoint: boolean // main or framework entry point
}

call_sites give you the syntactic calls within a body even at level 1; the semantic, resolved call graph is the level-2 call_graph. See CRUD detection for crud_operations / crud_queries.

{
comments: JComment[]
name: string[] // Declared names (supports multi-declarators)
type: string // Field type
start_line: number
end_line: number
modifiers: string[]
annotations: string[]
initializer: string // Initializer expression, if any
}
{
content: string // Comment text
start_line: number
end_line: number
start_column: number
end_column: number
is_javadoc: boolean // true for /** ... */ blocks
}

Comments appear both at file level (on the compilation unit and type) and attached to individual callables.

{
path: string // Fully-qualified name, or package for wildcards
is_static: boolean // true for "import static ..."
is_wildcard: boolean // true for "import ....*"
}

Records, enums, and initializer blocks have their own small entities referenced above:

  • JEnumConstant — an enum member, with its name, arguments, and comments.
  • JRecordComponent — a record component, with name, type, modifiers, and annotations.
  • JInitializationBlock — a static or instance initializer block, with its source and span.
  • JParameter — a callable parameter: name, type, annotations.
  • JVariableDeclaration — a local variable declared in a method body.
  • JCallSite — a single call expression inside a body (receiver, method name, argument types, location).

For the semantic call graph that resolves these call sites across the whole program, continue to the call graph schema.