我的版本是否违反了语义版本控制?基于语义区分的静态检测
Has My Release Disobeyed Semantic Versioning? Static Detection Based on Semantic Differencing
摘要:
为了增强Java第三方库(TPL)版本控制的兼容性,Maven采用Semantic Versioning(SemVer)规范版本的底层含义,但即使编译和链接成功,用户升级后仍可能面临异常执行和崩溃的问题。它是由语义破坏(SemB)问题引起的,例如用户直接使用的API具有相同的签名,但在升级过程中语义不一致。为了加强对SemVer规则的遵守,开发人员和用户应该注意这些问题。不幸的是,静态地检测它们是很有挑战性的,因为API的内部方法中的语义变化很难捕获。动态测试可以确认发现一些,但由于覆盖范围不足而受到限制。为了通过SemVer规则检测兼容升级(补丁和次要)上的SemB问题,我们对180个SemB问题进行了实证研究,以了解根本原因,受此启发,我们提出了Sembid(Semantic Breaking Issue Detector),用于静态检测开发人员和用户的TPL问题。由于用户直接使用API,Sembid会根据API检测和报告SemB问题。对于一对API,Sembid遍历源自API的调用链,通过测量语义差异来定位中断更改。然后,Sembid检查中断更改是否会影响API沿调用链的输出。测试结果显示,Sembid在SemB API检测上的召回率和准确率分别达到90.26%和81.29%,优于其他API检测器。我们还发现,Sembid检测到的SemB API比常用的解决方案单元测试多3倍,覆盖率更高。此外,我们对来自546个顶级Java库版本对的1,629,589个API进行了实证研究,发现SemB API比基于签名的问题多2-4倍。
英文摘要:
To enhance the compatibility in the version control of Java Third-party Libraries (TPLs), Maven adopts Semantic Versioning (SemVer) to standardize the underlying meaning of versions, but users could still confront abnormal execution and crash after upgrades even if compilation and linkage succeed. It is caused by semantic breaking (SemB) issues, such that APIs directly used by users have identical signatures but inconsistent semantics across upgrades. To strengthen compliance with SemVer rules, developers and users should be alerted of such issues. Unfortunately, it is challenging to detect them statically, because semantic changes in the internal methods of APIs are difficult to capture. Dynamic testing can confirmingly uncover some, but it is limited by inadequate coverage. To detect SemB issues over compatible upgrades (Patch and Minor) by SemVer rules, we conduct an empirical study on 180 SemB issues to understand the root causes, inspired by which, we propose Sembid (Semantic Breaking Issue Detector) to statically detect such issues of TPLs for developers and users. Since APIs are directly used by users, Sembid detects and reports SemB issues based on APIs. For a pair of APIs, Sembid walks through the call chains originating from the API to locate breaking changes by measuring semantic diff. Then, Sembid checks if the breaking changes can affect API's output along call chains. The evaluation showed Sembid achieved 90.26% recall and 81.29% precision and outperformed other API checkers on SemB API detection. We also revealed Sembid detected over 3 times more SemB APIs with better coverage than unit tests, the commonly used solution. Furthermore, we carried out an empirical study on 1,629,589 APIs from 546 version pairs of top Java libraries and found there were 2-4 times more SemB APIs than those with signature-based issues.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。