Detecting Mistyped Identifiers via Static Code Analysis
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
In dynamic programming languages where static resolution is not used, mistyped or misspelled identifiers can go undetected during development and testing, leading to costly software defects.
Innovation Solution
A code testing system performs static analysis by creating an occurrence table to track identifier usage and applies rules to identify and correct mistyped identifiers, using hash values and similarity comparisons to suggest corrections without relying on dynamic execution or predefined dictionaries.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If static resolution is used to detect mistyped identifiers, then detection reliability is improved, but device complexity and programming language restrictions increase
Solution Approach 1:
The patent segments the detection process into two independent phases: (1) gathering and indexing identifier occurrence information from the codebase, and (2) inferring defects by analyzing frequency and similarity patterns. This segmentation allows the system to operate on static code structures without requiring dynamic execution or complex language support, resolving the contradiction between detection reliability and language flexibility.
Solution Approach 2:
The patent introduces an intermediary occurrence table that indexes identifier occurrences across the codebase. This intermediary structure enables the system to detect mistyped identifiers by analyzing statistical patterns (frequency, similarity to other identifiers) rather than relying on direct static resolution mechanisms, thus improving detection capability without imposing language restrictions.
2Productivity
If static analysis is performed without running the program, then productivity is improved, but measurement precision of identifier correctness decreases
Solution Approach 1:
The system uses the codebase itself as the source of reference information for detecting mistyped identifiers. By indexing all identifier occurrences and analyzing their frequency and similarity patterns within the codebase, the system performs self-verification without external references or program execution, achieving both high productivity and accurate detection.
Solution Approach 2:
The patent replaces mechanical program execution with a statistical analysis mechanism. Instead of running the program to detect runtime errors, the system uses computational statistics (frequency counting, string similarity comparisons) on static code data to infer identifier correctness, thereby achieving fast analysis without sacrificing detection precision.
3Difficulty of detecting and measuring
If occurrence frequency threshold is set low to detect rare identifiers, then detection sensitivity is improved, but false positive rate increases
Solution Approach 1:
The patent changes the detection parameters from simple frequency thresholds to a multi-parameter analysis including: (1) occurrence frequency, (2) similarity to other identifiers, and (3) contextual patterns. This parameter transformation allows the system to detect rare but valid identifiers while filtering out false positives through comprehensive pattern matching rather than relying on arbitrary frequency cutoffs.
Data Source
AI summary
A code testing system determines mistyped identifiers in computer language code. For identifiers of objects in the code, such as variables and functions, the instances of the identifiers are identified in the code and recorded in an occurrence table. Uses of an identifier may be identified as copies of one another based on a hash value of the instance and its location in a function. Hash values for an identifier that are not unique may not be recorded in the instance table. For identifiers that are associated with a single occurrence or a single group of copies, these identifiers are identified as candidates for correction. Suggested corrections are determined based on a comparison with other identifiers in the occurrence table to determine similar identifiers in the occurrence table. If so, the candidate identifier may be identified as likely mistyped and the similar identifier is suggested as a correction.


