arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2204.00963cs.SE
收藏

涉及动态语言特征的单语句错误研究

A Study of Single Statement Bugs Involving Dynamic Language Features

Li Sui, Shawn Rasheed, Amjed Tahir, Jens Dietrich

摘要:

动态语言特征在程序设计语言中广泛可用,以实现可以适应多个使用上下文的功能,从而实现重用。数据绑定、对象关系映射和用户界面构建器等功能可能严重依赖于这些特性。然而,它们的使用有风险和缺点,因为它们影响静态分析和依赖于这种分析的技术(例如错误检测和自动程序修复)的可靠性。由于理解反射代码的潜在困难、编译时安全性的丧失和不正确的API使用,它们还可能使软件更容易出错。在本文中,我们开始量化在Java程序中使用动态语言功能的一些影响,也就是说,使用这些功能相对于一个特定类型的错误称为单语句错误的错误倾向。通过挖掘2,024个GitHub项目,我们发现了139个单语句bug实例(属于10种不同的bug模式),其中最多的bug属于三种特定模式:错误的函数名称,相同的函数更多的参数和更改使用的标识符。这些结果可以帮助从业者量化使用动态技术的风险,而不是替代技术(如代码生成)。我们希望这种分类引起人们对选择可能容易出错的动态API的关注,并为开发人员在设计此类功能的错误检测工具时提供更好的理解。

英文摘要:

Dynamic language features are widely available in programming languages to implement functionality that can adapt to multiple usage contexts, enabling reuse. Functionality such as data binding , object-relational mapping and user interface builders can be heavily dependent on these features. However, their use has risks and downsides as they affect the soundness of static analyses and techniques that rely on such analyses (such as bug detection and automated program repair). They can also make software more error-prone due to potential difficulties in understanding reflective code, loss of compile-time safety and incorrect API usage. In this paper, we set out to quantify some of the effects of using dynamic language features in Java programs-that is, the error-proneness of using those features with respect to a particular type of bug known as single statement bugs. By mining 2,024 GitHub projects, we found 139 single statement bug instances (falling under 10 different bug patterns), with the highest number of bugs belonging to three specific patterns: Wrong Function Name, Same Function More Args and Change Identifier Used. These results can help practitioners to quantify the risk of using dynamic techniques over alternatives (such as code generation). We hope this classification raises attention on choosing dynamic APIs that are likely to be error-prone, and provides developers a better understanding when designing bug detection tools for such feature.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑