Documentation
¶
Overview ¶
Package sourcecontract builds a contract.Store directly from Java source files under a project root. It exists so a fresh machine can run sofarpc_describe without Java, Spoon, or any local cache format.
File layout:
- store.go: public Store API surface (Load, Class, Size, Diagnostics).
- scan.go: project-root walk and lightweight FQN indexing.
- parse.go: Java-source token/structure parsing.
- materialize.go: parsed-class → javamodel.Class conversion and tree flattening.
- resolver.go: raw Java type string → canonical FQN resolution.
- textutil.go: primitive byte/string helpers shared by the parser.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Diagnostics ¶
type Diagnostics = contract.Diagnostics
Diagnostics surfaces the store's current health so sofarpc_open and sofarpc_doctor can report how many files were scanned, how many parsed successfully, and where the failures clustered.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is a lazily materialized contract store backed by Java source files. Load builds a light FQN->path index; Class(fqn) parses and caches a class on first access.
func Load ¶
Load scans projectRoot for Java source files and returns a Store when at least one top-level type can be indexed. Hidden and build-output directories are skipped so editor worktrees and generated trees do not dominate the result set. The scan is intentionally shallow: it records only FQN->file mappings and defers field/method parsing until Class(fqn) is called.
func (*Store) Class ¶
Class implements contract.Store. On a cache miss it parses the file backing fqn (including any nested declarations) and stores every top-level and inner class it finds, so subsequent Class() calls for siblings skip the I/O round-trip.
func (*Store) Diagnostics ¶
func (s *Store) Diagnostics() Diagnostics
Diagnostics snapshots the store's index/cache state for health reporting. Maps are cloned so callers cannot mutate internal state.
func (*Store) IndexedClasses ¶
IndexedClasses returns every top-level Java FQN discovered during the lightweight source scan. It does not force method/field parsing.