Modern software development relies on the reuse of code via Application Programming Interfaces (apis). Such reuse relieves developers from learning and developing established algorithms and data structures anew, enabl...
详细信息
ISBN:
(纸本)9798350353020;9798400705779
Modern software development relies on the reuse of code via Application Programming Interfaces (apis). Such reuse relieves developers from learning and developing established algorithms and data structures anew, enabling them to focus on their problem at hand. However, there is also the risk of misusing an api due to a lack of understanding or proper documentation. While many techniques target api misuse detection, only limited efforts have been put into automatically repairing api misuses. In this paper, we present our advances on our technique api-Specific Automated Program Repair (ASAP-Repair). ASAP-Repair is intended to fix api misuses based on api usage graphs (AUGs) by leveraging apiusage templates of state-of-the-art api misuse detectors. We demonstrate that ASAP-Repair is in principle applicable on an established api misuse dataset. Moreover, we discuss next steps and challenges to evolve ASAP-Repair towards a full-fledged Automatic Program Repair (APR) technique.
In modern software development, developers access reusable functionality provided by third-party libraries through Application Programming Interfaces (apis). However, using apis requires developers to conform specific...
详细信息
ISBN:
(纸本)9798350363982;9798400705878
In modern software development, developers access reusable functionality provided by third-party libraries through Application Programming Interfaces (apis). However, using apis requires developers to conform specific constraints and guidelines, otherwise it may lead to api misuses. Existing approaches for api misuse detection often rely on analyzing api documentation or mining client code. However, these approaches are limited by the quality of api documentation and the naive assumption that deviations from common usage patterns in client code imply potential api misuses, making them less reliable. In this paper, we propose an approach that comprehensively integrates the apiusage constraints from multiple sources, including client code, api documentation, and library code, to detect api misuses. First, we convert client code into api usage graphs (AUGs), extract the apiusage patterns, and apply heuristic filtering rules to obtain apiusage constraints. Meanwhile, we also analyze library code and api documentation to obtain various apiusage constraints. Next, we combine the obtained apiusage constraints from multiple sources together to generate a series of api preliminary constraint graphs. Based on these api preliminary constraint graphs, we design constraint alternative strategies to form api alternative constraint graphs. Finally, we parse the Abstract Syntax Tree (AST) of the test code and match it against api (alternative) constraint graphs to detect api misuses. The experimental evaluation demonstrates that our approach achieves the Precision of 72.22% and the Recall of 43.01% on the MUBench dataset, with an F1 score of 53.91%. These values significantly outperform existing state-of-the-art api misuse detection approaches, highlighting the effectiveness of integrating apiusage constraints from various sources. Additionally, the designed heuristic filtering rules and constraint alternative strategies significantly reduce false positives, enhancing the Pre
暂无评论