Class AcceptableModuleSizeOrError
- All Implemented Interfaces:
BiConsumer<String, List<ParsedModule>>
MetricLimits.MODULE_SIZE and emits E11027 if exceeded.
This is the god-module backstop. It is deliberately blunt and deliberately generous:
AcceptableModuleCohesionOrError (E11017) is the real design signal, because it
distinguishes 200 tightly-related constructs (fine) from 100 unrelated ones (not fine), which a
raw count never can. A count only catches the case cohesion cannot - a module that keeps growing
while staying technically connected.
Parameterised types are NOT counted. EK9 creates each monomorphised
List of String in the module that declares the GENERIC, not the module that uses it. So
counting generated types would (a) let one module's usage inflate another module's size, and
(b) make the limit effectively unhittable-by-design for any module exporting a generic. The count
is taken from ModuleCohesionTracker, which is populated by the phase-5 listener walking
the PARSE TREE - synthesised types never appear there, so they are excluded by construction
rather than by a filter that could later drift out of step.
Built-in modules are exempt, as they are for cohesion.
-
Constructor Summary
ConstructorsConstructorDescriptionAcceptableModuleSizeOrError(ModuleCohesionTracker moduleCohesionTracker, AcceptableModuleCohesionOrError.ErrorListenerLookup errorListenerLookup) -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(String moduleName, List<ParsedModule> parsedModules) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface BiConsumer
andThen
-
Constructor Details
-
AcceptableModuleSizeOrError
AcceptableModuleSizeOrError(ModuleCohesionTracker moduleCohesionTracker, AcceptableModuleCohesionOrError.ErrorListenerLookup errorListenerLookup)
-
-
Method Details
-
accept
- Specified by:
acceptin interfaceBiConsumer<String, List<ParsedModule>>
-