paperbot · PL 论文追踪

全部论文 待读 收藏

P2 APIzation: Generating Reusable APIs from StackOverflow Code Snippets

APIzation:从 StackOverflow 代码片段自动生成可复用 API
ASE 2021 36th IEEE/ACM International Conference on Automated Software Engineering (ASE)2021匹配度 3/10 · 论文属于静态分析与程序变换/开发者工具,使用静态分析从代码片段中提取参数和返回值,与用户关注的程序分析有一定技术交集;但它不涉及 LLM/Agent、ML 系统、浮点程序分析或贝叶斯程序分析,也没有与 LLM 结合,因此与画像核心方向匹配度较低。引用 13 inbox
Valerio Terragni, Pasquale Salza
crossref: 2026-09-12

AI 速览

一句话:提出 APIZATOR,用静态分析自动将 StackOverflow 代码片段转化为含参数与返回值的方法声明。

StackOverflow 等开发者论坛已成为现代软件开发的重要资源,但其中的代码片段往往缺少完整的方法声明,直接复用并不现实:开发者必须手动将变量参数化并确定返回值,这一过程被称为代码片段的 APIzation,既繁琐又耗时。本文提出 APIZATOR,用于自动完成 JAVA 代码片段的 APIzation。作者通过研究 GitHub 上真实的 APIzation 提炼出四种常见模式,并据此设计了一个静态分析算法,自动提取方法参数与 return 语句。评估采用 20 名开发者标注的 200 个 APIzation 作为 ground truth:在 113 个(56.50%)和 115 个(57.50%)案例中,APIZATOR 提取的参数与返回值分别与开发者完全一致;在 163 个(81.50%)案例中,参数或返回值至少有一项与开发者一致。

问题
StackOverflow 代码片段通常缺少完整的方法声明,开发者需要手动参数化变量并确定返回值(即 APIzation),该过程繁琐且耗时。
方法
提出 APIZATOR,基于从 GitHub 真实 APIzation 中总结的四种常见模式,设计静态分析算法自动提取 Java 代码片段的方法参数与 return 语句。
评估
以 20 名开发者标注的 200 个 APIzation 作为 ground truth,比较工具与开发者提取的参数和返回值;在 113(56.50%)和 115(57.50%)个案例中两者完全一致,163(81.50%)个案例中至少一项一致。
原文摘要(Abstract)

Developer forums like StackOverflow have become essential resources to modern software development practices. However, many code snippets lack a well-defined method declaration, and thus they are often incomplete for immediate reuse. Developers must adapt the retrieved code snippets by parameterizing the variables involved and identifying the return value. This activity, which we call APIzation of a code snippet, can be tedious and time-consuming. In this paper, we present APIZATOR to perform APIzations of JAVA code snippets automatically. APIZATOR is grounded by four common patterns that we extracted by studying real APIzations in GitHub. APIZATOR presents a static analysis algorithm that automatically extracts the method parameters and return statements. We evaluated APIZATOR with a ground-truth of 200 APIzations collected from 20 developers. For 113 (56.50 %) and 115 (57.50 %) APIzations, APIZATOR and the developers extracted identical parameters and return statements, respectively. For 163 (81.50 %) APIzations, either the parameters or the return statements were identical.

链接与引用

DOI 原文 ·

BibTeX
@inproceedings{paperbot6540,
  title = {APIzation: Generating Reusable APIs from StackOverflow Code Snippets},
  author = {Valerio Terragni and Pasquale Salza},
  booktitle = {ASE},
  year = {2021},
  doi = {10.1109/ase51524.2021.9678576}
}