API-Misuse Detection Driven by Fine-Grained API-Constraint Knowledge Graph
API 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 misuse. However, there is a big knowledge gap between API usage patterns and API usage caveats in terms of comprehensiveness, explainability and best practices. In this work, we propose a novel approach that detects API misuses directly against the API caveat knowledge, rather than API usage patterns. We develop open information extraction methods to construct a novel API-constraint knowledge graph from API reference documentation. This knowledge graph explicitly models two types of API-constraint relations (call-order and condition-checking) and enriches return and throw relations with return conditions and exception triggers. It empowers the detection of three types of frequent API misuses - missing calls, missing condition checking and missing exception handling, while existing detectors mostly focus on only missing calls. As a proof-of-concept, we apply our approach to Java SDK API Specification. Our evaluation confirms the high accuracy of the extracted API-constraint relations. Our knowledge-driven API misuse detector achieves 0.60 (68/113) precision and 0.28 (68/239) recall for detecting Java API misuses in the API misuse benchmark MuBench. This performance is significantly higher than that of existing pattern-based API misused detectors. A pilot user study with 12 developers shows that our knowledge-driven API misuse detection is very promising in helping developers avoid API misuses and debug the bugs caused by API misuses.
Wed 23 SepDisplayed time zone: (UTC) Coordinated Universal Time change
01:10 - 02:10
|API-Misuse Detection Driven by Fine-Grained API-Constraint Knowledge Graph|
Xiaoxue Ren Zhejiang University, Xinyuan Ye Australian National University, Zhenchang Xing Australian National University, Australia, Xin Xia Monash University, Xiwei Xu Data61 at CSIRO, Australia, Liming Zhu Data61 at CSIRO, Australia / UNSW, Australia, Jianling Sun Zhejiang UniversityPre-print
|Multi-task Learning based Pre-trained Language Model for Code Completion|
|HomoTR: Online Test Recommendation System Based on Homologous Code Matching|