Skip to main content

Module emitter

Module emitter 

Source
Expand description

Emit classpath nodes and edges into the sqry unified graph.

This module takes a ClasspathIndex (produced by bytecode parsing) and emits synthetic graph nodes and edges into a StagingGraph. Each JAR gets a synthetic FileId via FileRegistry::register_external(), and each class/method/field becomes a graph node with zero-span metadata (since the data comes from bytecode, not source).

§Emission pipeline

  1. File registration - For each unique JAR path, register a synthetic FileEntry with path convention {jar_path}!/{fqn}.class.
  2. Node emission - For each ClassStub, emit nodes for the class itself, its methods, fields, annotations, type parameters, enum constants, lambda targets, and module declarations.
  3. Structural edges - Class→Method (Defines), Class→Field (Defines), Class→InnerClass (Contains).
  4. Metadata attachment - ClasspathNodeMetadata on all emitted nodes (class, method, field, enum constant, type parameter, lambda target, module).

After emission, the returned FQN→NodeId mapping is used by register_classpath_exports and create_classpath_edges for ExportMap registration and cross-reference edge creation.

Structs§

ClasspathNodeRef
Duplicate-aware emitted node reference.
EmissionResult
Result of classpath node emission.

Functions§

create_classpath_edges
Create inheritance, generic, annotation, module, and inner-class edges for classpath nodes.
emit_classpath_nodes
Emit all classpath nodes and edges into a staging graph.
emit_into_code_graph
Emit classpath nodes and structural edges directly into a CodeGraph.
register_classpath_exports
Register classpath nodes in the ExportMap for cross-file resolution.