当前位置: X-MOL 学术arXiv.cs.SE › 论文详情
Our official English website, www.x-mol.net, welcomes your feedback! (Note: you will need to create a separate account there.)
Clone-Seeker: Effective Code Clone Search Using Annotations
arXiv - CS - Software Engineering Pub Date : 2021-06-06 , DOI: arxiv-2106.03042
Muhammad Hammad, Önder Babur, Hamid Abdul Basit, Mark van den Brand

Source code search plays an important role in software development, e.g. for exploratory development or opportunistic reuse of existing code from a code base. Often, exploration of different implementations with the same functionality is needed for tasks like automated software transplantation, software diversification, and software repair. Code clones, which are syntactically or semantically similar code fragments, are perfect candidates for such tasks. Searching for code clones involves a given search query to retrieve the relevant code fragments. We propose a novel approach called Clone-Seeker that focuses on utilizing clone class features in retrieving code clones. For this purpose, we generate metadata for each code clone in the form of a natural language document. The metadata includes a pre-processed list of identifiers from the code clones augmented with a list of keywords indicating the semantics of the code clone. This keyword list can be extracted from a manually annotated general description of the clone class, or automatically generated from the source code of the entire clone class. This approach helps developers to perform code clone search based on a search query written either as source code terms, or as natural language. In our quantitative evaluation, we show that (1) Clone-Seeker has a higher recall when searching for semantic code clones (i.e., Type-4) in BigCloneBench than the state-of-the-art; and (2) Clone-Seeker can accurately search for relevant code clones by applying natural language queries.

中文翻译:

Clone-Seeker:使用注释进行有效的代码克隆搜索

源代码搜索在软件开发中扮演着重要的角色,例如探索性开发或对代码库中现有代码的机会性重用。通常,自动软件移植、软件多样化和软件修复等任务需要探索具有相同功能的不同实现。代码克隆是句法或语义上相似的代码片段,是此类任务的完美候选者。搜索代码克隆涉及给定的搜索查询以检索相关代码片段。我们提出了一种称为 Clone-Seeker 的新方法,该方法侧重于在检索代码克隆时利用克隆类功能。为此,我们以自然语言文档的形式为每个代码克隆生成元数据。元数据包括来自代码克隆的预处理的标识符列表,增加了指示代码克隆语义的关键字列表。该关键字列表可以从克隆类的手动注释一般描述中提取,也可以从整个克隆类的源代码中自动生成。这种方法可帮助开发人员根据编写为源代码术语或自然语言的搜索查询执行代码克隆搜索。在我们的定量评估中,我们表明 (1) Clone-Seeker 在 BigCloneBench 中搜索语义代码克隆(即 Type-4)时比最先进的技术具有更高的召回率;(2) Clone-Seeker 可以通过应用自然语言查询来准确搜索相关的代码克隆。该关键字列表可以从克隆类的手动注释一般描述中提取,也可以从整个克隆类的源代码中自动生成。这种方法可帮助开发人员根据编写为源代码术语或自然语言的搜索查询执行代码克隆搜索。在我们的定量评估中,我们表明 (1) Clone-Seeker 在 BigCloneBench 中搜索语义代码克隆(即 Type-4)时比最先进的具有更高的召回率;(2) Clone-Seeker 可以通过应用自然语言查询来准确搜索相关的代码克隆。该关键字列表可以从克隆类的手动注释一般描述中提取,也可以从整个克隆类的源代码中自动生成。这种方法可帮助开发人员根据编写为源代码术语或自然语言的搜索查询执行代码克隆搜索。在我们的定量评估中,我们表明 (1) Clone-Seeker 在 BigCloneBench 中搜索语义代码克隆(即 Type-4)时比最先进的技术具有更高的召回率;(2) Clone-Seeker 可以通过应用自然语言查询来准确搜索相关的代码克隆。这种方法可帮助开发人员根据编写为源代码术语或自然语言的搜索查询执行代码克隆搜索。在我们的定量评估中,我们表明 (1) Clone-Seeker 在 BigCloneBench 中搜索语义代码克隆(即 Type-4)时比最先进的技术具有更高的召回率;(2) Clone-Seeker 可以通过应用自然语言查询来准确搜索相关的代码克隆。这种方法可帮助开发人员根据编写为源代码术语或自然语言的搜索查询执行代码克隆搜索。在我们的定量评估中,我们表明 (1) Clone-Seeker 在 BigCloneBench 中搜索语义代码克隆(即 Type-4)时比最先进的技术具有更高的召回率;(2) Clone-Seeker 可以通过应用自然语言查询来准确搜索相关的代码克隆。
更新日期:2021-06-08
down
wechat
bug