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 Sep Times are displayed in time zone: (UTC) Coordinated Universal Time change
|01:10 - 01:30|
Xiaoxue RenZhejiang University, Xinyuan YeAustralian National University, Zhenchang XingAustralian National University, Australia, Xin XiaMonash University, Xiwei XuData61 at CSIRO, Australia, Liming ZhuData61 at CSIRO, Australia / UNSW, Australia, Jianling SunZhejiang UniversityPre-print
|01:30 - 01:50|
|01:50 - 02:00|