Class ConstantOrganizationOrError

java.lang.Object
org.ek9lang.compiler.phase1.ConstantOrganizationOrError
All Implemented Interfaces:
BiConsumer<String, List<ParsedModule>>

final class ConstantOrganizationOrError extends Object implements BiConsumer<String, List<ParsedModule>>
Checks constant organization within a multi-file module and emits errors if constants are scattered. Only applies to modules spanning 2+ source files — single-file modules are exempt because constants are already consolidated by definition.
  • E11066: Constants scattered across 3+ files within a module — consolidate into one file
  • E11067: 2+ files with constants AND 10+ total constants — use a dedicated constants file

Built-in modules (org.ek9.*) are exempt as they have intentional structure.

The E11066 threshold of 3+ files (not 2) avoids false positives on common patterns like a main file plus a constants file in the same module. Three or more files with constants signals genuine fragmentation of a module's vocabulary.

E11067 is an independent check: even a two-file module with many constants across both files should consolidate them. The 10-constant minimum avoids noise on small modules.