Class ConfusinglySimilarNamesOrError
java.lang.Object
org.ek9lang.compiler.phase5.ConfusinglySimilarNamesOrError
- All Implemented Interfaces:
Consumer<org.antlr.v4.runtime.tree.ParseTree>
final class ConfusinglySimilarNamesOrError
extends Object
implements Consumer<org.antlr.v4.runtime.tree.ParseTree>
Detects confusingly similar variable, parameter, and field names within the same scope.
Research shows similar names are a significant bug source (Empirical Software Engineering 2023, arXiv 2025). This check flags pairs where:
- Levenshtein distance <= 2 (case change = 1, char substitution = 2)
- Both have the same type (type system won't catch misuse)
- Developer controls both names (not inherited/trait methods)
Intentionally skips:
- Exact param=field match (common constructor pattern)
- Different types (type system catches misuse)
- Loop variables (i, j, k are conventional)
-
Constructor Summary
ConstructorsConstructorDescriptionConfusinglySimilarNamesOrError(SymbolsAndScopes symbolsAndScopes, ErrorListener errorListener) -
Method Summary
-
Constructor Details
-
ConfusinglySimilarNamesOrError
ConfusinglySimilarNamesOrError(SymbolsAndScopes symbolsAndScopes, ErrorListener errorListener)
-
-
Method Details
-
accept
-