API Misuse Correction: A Statistical Approach
This addresses a critical issue for software developers by providing a tool to correct API misuses automatically, though it is incremental as it builds on prior detection methods.
The paper tackles the problem of automatically detecting and repairing API misuses in software development, which can cause serious programming errors, by proposing SAM, a statistical approach that achieves this with improved accuracy over existing methods.
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 SAM, a novel approach to detect and repair API misuses automatically. SAM uses statistical models to describe five factors involving in any API method call: related method calls, exceptions, pre-conditions, post-conditions, and values of arguments. These statistical models are trained from a large repository of high-quality production code. Then, given a piece of code, SAM verifies each of its method calls with the trained statistical models. If a factor has a sufficiently low probability, the corresponding call is considered as an API misuse. SAM performs an optimal search for editing operations to apply on the code until it has no API issue.