ABSTRACT
Modern software development relies heavily on Application Programming Interface (API) libraries. However, there are often certain constraints on using API elements in such libraries. Failing to follow such constraints (API misuse) could lead to serious programming errors. Many approaches have been proposed to detect API misuses, but they still have low accuracy and cannot repair the detected misuses. In this paper, we propose FAMI, a novel approach to detect and repair API misuses automatically. FAMI uses fuzzy set theory to represent usage rules of five factors involving in any API method call: related method calls, exceptions, pre-conditions, post-conditions, and values of arguments. These fuzzy sets are trained from a large repository of high-quality production code. Then, given a piece of code, FAMI verifies each of its method calls with the trained fuzzy sets. If a factor violates a usage rule defined by a fuzzy set, the corresponding call is considered as an API misuse. FAMI performs an optimal search for editing operations to apply on the code until it has no API issue.
- S. Amann, S. Nadi, H. A. Nguyen, T. N. Nguyen, and M. Mezini. 2016. MUBench: A Benchmark for API-Misuse Detectors. In MSR. Austin, USA.Google Scholar
- S. Amann, H. A. Nguyen, S. Nadi, T. N. Nguyen, and M. Mezini. 2018. A Systematic Evaluation of Static API-Misuse Detectors. TSE (2018).Google Scholar
- S. Amann, H. A. Nguyen, S. Nadi, T. N.Nguyen, and M. Mezini. 2019. Investigating Next Steps in Static API-misuse Detection. In MSR. Montreal, Canada.Google Scholar
- M. Kechagia and D. Spinellis. 2014. Undocumented and Unchecked: Exceptions That Spell Trouble. In MSR. Hyderabad, India.Google Scholar
- T. Luo, J. Wu, M. Yang, S. Zhao, Y. Wu, and Y. Wang. 2018. MAD-API: Detection, Correction and Explanation of API Misuses in Distributed Android Applications. In AIMS. Taipei, Taiwan.Google Scholar
- M. Monperrus, M. Bruch, and M. Mezini. 2010. Detecting Missing Method Calls in Object-Oriented Software. In ECOOP. Maribor, Slovenia.Google Scholar
- M. Monperrus and M. Mezini. 2013. Detecting Missing Method Calls As Violations of the Majority Rule. TOSEM (2013).Google Scholar
- T. Nguyen, H. Nguyen, N. Pham, J. Al-Kofahi, and T. Nguyen. 2009. Graph-based Mining of Multiple Object Usage Patterns. In FSE. Amsterdam, Netherlands.Google Scholar
- T. Nguyen, H. Pham, P. Vu, and T. Nguyen. 2015. Recommending API Usages for Mobile Apps with Hidden Markov Model. In ASE. Lincoln, USA.Google Scholar
- T. Nguyen, P. Vu, and T. Nguyen. 2019. API Misuse Correction: A Statistical Approach. In ASE. San Diego, USA.Google Scholar
- T. Nguyen, P. Vu, and T. Nguyen. 2019. An Empirical Study of Exception Handling Bugs and Fixes. In ACMSE. Kennesaw, USA.Google Scholar
- T. Nguyen, P. Vu, and T. Nguyen. 2019. Recommending Exception Handling Code. In ICSME. Cleveland, USA.Google Scholar
- M. Syer, M. Nagappan, A. Hassan, and B. Adams. 2013. Revisiting Prior Empirical Findings for Mobile Apps: An Empirical Case Study on the 15 Most Popular Open-source Android Apps. In CASCON. Riverton, USA.Google Scholar
- S. Thummalapenta and T. Xie. 2009. Alattin: Mining Alternative Patterns for Detecting Neglected Conditions. In ASE. Auckland, New Zealand.Google Scholar
- S. Thummalapenta and T. Xie. 2009. Mining Exception-handling Rules As Sequence Association Rules. In ICSE. Vancouver, Canada.Google Scholar
- A. Wasylkowski and A. Zeller. 2009. Mining Temporal Specifications from Object Usage. In ASE. Auckland, New Zealand.Google Scholar
- A. Wasylkowski, A. Zeller, and C. Lindig. 2007. Detecting Object Usage Anomalies. In FSE. New York, USA.Google Scholar
Index Terms
- API Misuse Correction: A Fuzzy Logic Approach
Recommendations
Demystify official API usage directives with crowdsourced API misuse scenarios, erroneous code examples and patches
ICSE '20: Proceedings of the ACM/IEEE 42nd International Conference on Software EngineeringAPI usage directives in official API documentation describe the contracts, constraints and guidelines for using APIs in natural language. Through the investigation of API misuse scenarios on Stack Overflow, we identify three barriers that hinder the ...
API-misuse detection driven by fine-grained API-constraint knowledge graph
ASE '20: Proceedings of the 35th IEEE/ACM International Conference on Automated Software EngineeringAPI misuses cause significant problem in software development. Existing methods detect API misuses against frequent API usage patterns mined from codebase. They make a naive assumption that API usage that deviates from the most-frequent API usage is a ...
Effective and efficient API misuse detection via exception propagation and search-based testing
ISSTA 2019: Proceedings of the 28th ACM SIGSOFT International Symposium on Software Testing and AnalysisApplication Programming Interfaces (APIs) typically come with (implicit) usage constraints. The violations of these constraints (API misuses) can lead to software crashes. Even though there are several tools that can detect API misuses, most of them ...
Comments