sourcecontract

package
v0.0.0-...-c671013 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

func Load(projectRoot string) (*Store, error)

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

func (s *Store) Class(fqn string) (javamodel.Class, bool)

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

func (s *Store) IndexedClasses() []string

IndexedClasses returns every top-level Java FQN discovered during the lightweight source scan. It does not force method/field parsing.

func (*Store) Size

func (s *Store) Size() int

Size returns the number of classes loaded into the store.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL