Class AcceptableCohesionOrError
java.lang.Object
org.ek9lang.compiler.phase5.AcceptableCohesionOrError
- All Implemented Interfaces:
Consumer<org.antlr.v4.runtime.tree.ParseTree>
class AcceptableCohesionOrError
extends Object
implements Consumer<org.antlr.v4.runtime.tree.ParseTree>
Checks LCOM4 cohesion against thresholds and emits errors if exceeded.
Based on Hitz & Montazeri (1995) "Measuring Coupling and Cohesion In Object-Oriented Systems".
LCOM4 = 1 means perfect cohesion (all methods connected). Higher values suggest the class should be split.
Thresholds:
- class: max 8
- service/component: max 10
Exempt from LCOM4 threshold checking:
- Stateless classes - no fields means no state to share, LCOM4 not meaningful.
- Traits - interface-like with abstract method signatures. Abstract methods have no body, so can't access fields - LCOM4 not meaningful.
- Records - value types (structs) with operators, not OOP classes with methods. Operators are naturally independent by design. Functions operate on records externally.
- Functions - single body, LCOM4 always 1. Unused captures detected by E11018.
- Built-in types - primitive utilities with many independent operators.
-
Constructor Summary
ConstructorsConstructorDescriptionAcceptableCohesionOrError(SymbolsAndScopes symbolsAndScopes, ErrorListener errorListener, CohesionTracker cohesionTracker) -
Method Summary
-
Constructor Details
-
AcceptableCohesionOrError
AcceptableCohesionOrError(SymbolsAndScopes symbolsAndScopes, ErrorListener errorListener, CohesionTracker cohesionTracker)
-
-
Method Details
-
accept
-