一句话:提出 Oreo,结合机器学习、信息检索与软件度量,检测 Type-1 至 Type-3 及 Twilight Zone 代码克隆。
源代码克隆按检测难度分为四类,从纯文本的 Type-1 到纯语义的 Type-4。现有克隆检测器大多只能较好处理 Type-3,即句法差异克隆;而在 Type-3 与 Type-4 之间存在仍具有一定句法相似性但极难检测的“暮光区”(Twilight Zone)。本文提出 Oreo,一种结合机器学习、信息检索与软件度量的新型克隆检测方法,不仅准确检测 Type-1 至 Type-3 克隆,还能检测暮光区中更难检测的克隆。作者在 BigCloneBench 上评估 Oreo 的召回率,并通过人工评估精确率。结果表明 Oreo 同时具有高召回率和高精确率,并能以可扩展方式推进对中等到弱句法相似性克隆的检测边界。
Source code clones are categorized into four types of increasing difficulty of detection, ranging from purely textual (Type-1) to purely semantic (Type-4). Most clone detectors reported in the literature work well up to Type-3, which accounts for syntactic differences. In between Type-3 and Type-4, however, there lies a spectrum of clones that, although still exhibiting some syntactic similarities, are extremely hard to detect – the Twilight Zone. Most clone detectors reported in the literature fail to operate in this zone. We present Oreo, a novel approach to source code clone detection that not only detects Type-1 to Type-3 clones accurately, but is also capable of detecting harder-to-detect clones in the Twilight Zone. Oreo is built using a combination of machine learning, information retrieval, and software metrics. We evaluate the recall of Oreo on BigCloneBench, and perform manual evaluation for precision. Oreo has both high recall and precision. More importantly, it pushes the boundary in detection of clones with moderate to weak syntactic similarity in a scalable manner