Abstract
Identifiers in source code are composed of terms in natural languages. Such terms, as well as phrases composed of such terms, convey rich semantics that could be exploited for program analysis and comprehension. To this end, in this paper we propose a deep learning based approach, called MLDetector, to identifying suspicious return statements by leveraging semantics conveyed by the natural language phrases that are used as identifiers in the source code. We specially design a deep neural network to tell whether a given return statement matches its corresponding method signature. The rationale is that both method signature and return value should explicitly specify the output of the method, and thus a significant mismatch between method signature and return value may suggest a suspicious return statement. To address the challenge of lacking negative training data, i.e., incorrect return statements, we generate negative training data automatically by transforming real-world correct return statements. To feed code into neural network, we convert them into vectors by Word2Vec, an unsupervised neural network based learning algorithm. We evaluate the proposed approach in two parts. In the first part, we evaluate it on 500 open-source applications by automatically generating labeled training data. Results suggest that the precision of the proposed approach varies from 83% to 90%. In the second part, we conduct a case study on 100 real-world applications. Evaluation results suggest that 42 out of 65 real-world incorrect return statements are detected (with precision of 59%).
| Original language | English |
|---|---|
| Title of host publication | SANER 2020 - Proceedings of the 2020 IEEE 27th International Conference on Software Analysis, Evolution, and Reengineering |
| Editors | Kostas Kontogiannis, Foutse Khomh, Alexander Chatzigeorgiou, Marios-Eleftherios Fokaefs, Minghui Zhou |
| Publisher | Institute of Electrical and Electronics Engineers Inc. |
| Pages | 480-491 |
| Number of pages | 12 |
| ISBN (Electronic) | 9781728151434 |
| DOIs | |
| State | Published - Feb 2020 |
| Externally published | Yes |
| Event | 27th IEEE International Conference on Software Analysis, Evolution, and Reengineering, SANER 2020 - London, Canada Duration: 18 Feb 2020 → 21 Feb 2020 |
Publication series
| Name | SANER 2020 - Proceedings of the 2020 IEEE 27th International Conference on Software Analysis, Evolution, and Reengineering |
|---|
Conference
| Conference | 27th IEEE International Conference on Software Analysis, Evolution, and Reengineering, SANER 2020 |
|---|---|
| Country/Territory | Canada |
| City | London |
| Period | 18/02/20 → 21/02/20 |
Bibliographical note
Publisher Copyright:© 2020 IEEE.
Keywords
- Bug Detection
- Code Quality
- Deep Learning
- Identification
- Program Analysis
- Return Value
ASJC Scopus subject areas
- Organizational Behavior and Human Resource Management
- Hardware and Architecture
- Software
- Safety, Risk, Reliability and Quality
- Computer Networks and Communications