{"modulePath":"github.com/hex1n/sofarpc-cli","version":"v0.0.0-20261202072051-c67101320811","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package sourcecontract\n\nPackage 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.\n\nFile layout:\n\n  - store.go:       public Store API surface (Load, Class, Size, Diagnostics).\n  - scan.go:        project-root walk and lightweight FQN indexing.\n  - parse.go:       Java-source token/structure parsing.\n  - materialize.go: parsed-class → javamodel.Class conversion and tree flattening.\n  - resolver.go:    raw Java type string → canonical FQN resolution.\n  - textutil.go:    primitive byte/string helpers shared by the parser.\n\n## Types\n\n```go\ntype Diagnostics = contract.Diagnostics\n```\nDiagnostics 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.\n\n```go\ntype Store struct {\n\t// contains filtered or unexported fields\n}\n```\nStore is a lazily materialized contract store backed by Java source files. Load builds a light FQN-\u003epath index; Class(fqn) parses and caches a class on first access.\n\n```go\nfunc Load(projectRoot string) (*Store, error)\n```\nLoad 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-\u003efile mappings and defers field/method parsing until Class(fqn) is called.\n\n```go\nfunc (s *Store) Class(fqn string) (javamodel.Class, bool)\n```\nClass 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.\n\n```go\nfunc (s *Store) Diagnostics() Diagnostics\n```\nDiagnostics snapshots the store's index/cache state for health reporting. Maps are cloned so callers cannot mutate internal state.\n\n```go\nfunc (s *Store) IndexedClasses() []string\n```\nIndexedClasses returns every top-level Java FQN discovered during the lightweight source scan. It does not force method/field parsing.\n\n```go\nfunc (s *Store) Size() int\n```\nSize returns the number of classes loaded into the store.\n\n","path":"github.com/hex1n/sofarpc-cli/internal/sourcecontract","name":"sourcecontract","synopsis":"Package sourcecontract builds a contract.Store directly from Java source files under a project root.","isRedistributable":true}
