A method for intelligent detection of source code defects related to conditional expressions
By using a control flow graph-based graph neural network (CFGNN) model, combined with a bidirectional long short-term memory network and an API usage attention mechanism, the problems of information loss and insufficient long-distance dependency capture in deep learning methods are solved, and more accurate condition defect detection is achieved.
CN116627428BActive Publication Date: 2026-06-05BEIHANG UNIV
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIHANG UNIV
- Filing Date
- 2023-06-21
- Publication Date
- 2026-06-05
Smart Images

Figure CN116627428B_ABST
Abstract
The application realizes a kind of conditional expression related source code defect intelligent detection method.The overall process includes preprocessing, node embedding, control flow coding and API usage attention mechanism;Given a Java method and the conditional expression to be checked, the preprocessing first parses it into CFG form;The node embedding uses bidirectional long short-term memory network to encode the statement into node vector;The control flow coding is on the node vector, and uses the LSTM unit of single graph structure to encode each node encountered along the control flow path of CFG;The API usage attention mechanism combines the attention module with the API label of the statement;After the attention mechanism, multiple node vectors are converted into a single vector, and the semantics of the conditional defect is learned and identified in an end-to-end manner.The problem that important control flow information of source code may be missed in the source code conditional defect detection problem is solved.
Need to check novelty before this filing date? Find Prior Art