Class DataClumpTracker
java.lang.Object
org.ek9lang.compiler.phase5.DataClumpTracker
Tracks function/method/constructor parameter signatures for data clump detection (E11053).
A data clump occurs when the same group of 4+ parameters (by type and name) appears
in 3+ callable signatures within a module, signalling a missing record abstraction.
Thread-safe: designed to be used during parallel file processing where multiple PreIRListener instances (one per file) share a single DataClumpTracker.
Based on Martin Fowler's "Refactoring" (1999): data clumps are groups of data that always appear together — they should be extracted into their own object.
Complexity: O(S) where S = total signatures recorded — linear collection phase.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final recordAn immutable (type, name) pair from a parameter, ordered for deterministic comparison.(package private) static final recordOne callable's parameter signature for data clump analysis. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) List<DataClumpTracker.SignatureRecord> getSignatures(String moduleName) Get a snapshot copy of signatures for a specific module.(package private) static booleanCheck if a module is exempt from data clump checking.(package private) voidRecord a callable's parameter signature for a specific module.
-
Constructor Details
-
DataClumpTracker
DataClumpTracker()
-
-
Method Details
-
recordSignature
Record a callable's parameter signature for a specific module. Only records if the callable has at least 4 parameters with resolved types.- Parameters:
moduleName- the module containing the callablecallableName- the name of the function/method/constructorparams- the parameter symbolstoken- the source token for error reporting
-
getSignatures
Get a snapshot copy of signatures for a specific module.- Parameters:
moduleName- the module to query- Returns:
- list of signature records (may be empty, never null)
-
isExempt
Check if a module is exempt from data clump checking. Built-in modules (org.ek9.*) are exempt because their parameter patterns are intentional and part of the language runtime design.- Parameters:
moduleName- the module to check- Returns:
- true if exempt (built-in modules)
-