paperbot · PL 论文追踪

全部论文 待读 收藏

P2 KGAMD: an API-misuse detector driven by fine-grained API-constraint knowledge graph

KGAMD:一种由细粒度 API 约束知识图谱驱动的 API 误用检测器
FSE Proceedings of the 29th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering2021匹配度 3/10 · 该论文属于静态程序分析与开发者工具,构建API约束知识图谱检测误用,但未涉及用户核心关注的LLM/Agent与程序分析交叉、浮点程序分析或贝叶斯程序分析。引用 1 inbox
Xiaoxue Ren, Xinyuan Ye, Zhenchang Xing, Xin Xia, Xiwei Xu, Liming Zhu, Jianling Sun
crossref: 2026-09-12

AI 速览

一句话:提出 KGAMD,从 API 文档构建细粒度 API 约束知识图谱,并直接据此检测多种 API 误用。

API 通常带有使用约束,违反约束(API 误用)会引发严重问题。现有方法从代码库挖掘频繁使用模式,假设偏离最常见用法即为误用,但使用模式与真实 API 约束在全面性、可解释性和最佳实践上存在知识鸿沟。本文提出 KGAMD,直接基于 API 约束知识检测误用:用开放信息抽取从 API 参考文档构建细粒度约束知识图谱,显式建模调用顺序与条件检查关系,并用返回条件与异常触发丰富返回和抛出关系。基于该图谱,KGAMD 检测缺失调用、缺失条件检查和缺失异常处理三类误用,而现有检测器多只关注缺失调用。定量评估与用户研究显示其能帮助开发者避免和调试 API 误用。

问题
现有 API 误用检测依赖频繁 API 使用模式,并假设偏离最常见用法的使用即为误用,但使用模式与真实 API 使用约束之间存在全面性、可解释性和最佳实践方面的知识鸿沟。
方法
从 API 参考文档用开放信息抽取构建细粒度 API 约束知识图谱,显式建模调用顺序与条件检查关系,并丰富返回条件和异常触发;KGAMD 基于该图谱检测缺失调用、缺失条件检查和缺失异常处理三类 API 误用。
评估
通过定量评估和用户研究验证 KGAMD 在帮助开发者避免与调试 API 误用方面的效果。
原文摘要(Abstract)

Application Programming Interfaces (APIs) typically come with usage constraints. The violations of these constraints (i.e. API misuses) can cause significant problems in software development. Existing methods mine frequent API usage patterns from codebase to detect API misuses. 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 constraints in terms of comprehensiveness, explainability and best practices. Inspired by this, we propose a novel approach named KGAMD (API-Misuse Detector Driven by Fine-Grained API-Constraint Knowledge Graph) that detects API misuses directly against the API constraint knowledge, rather than API usage pat-terns. We first construct a novel API-constraint knowledge graph from API reference documentation with open information extraction methods. 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. Then, we develop the KGAMD tool that utilizes the knowledge graph to detect API misuses. There are three types of frequent API misuses we can detect - missing calls, missing condition checking and missing exception handling, while existing detectors mostly focus on only missing calls. Our quantitative evaluation and user study demonstrate that our KGAMD is promising in helping developers avoid and debug API misuses

链接与引用

DOI 原文 ·

BibTeX
@inproceedings{paperbot6418,
  title = {KGAMD: an API-misuse detector driven by fine-grained API-constraint knowledge graph},
  author = {Xiaoxue Ren and Xinyuan Ye and Zhenchang Xing and Xin Xia and Xiwei Xu and Liming Zhu and Jianling Sun},
  booktitle = {FSE},
  year = {2021},
  doi = {10.1145/3468264.3473112}
}