一句话:提出 DeepDelta,用 NMT 从 Google 构建数据学习编译错误修复模式,为缺失符号和方法签名不匹配生成修复。
程序员需花费大量时间手动修复无法编译的代码,而同一类编译错误的修复往往遵循高度机械的模式。本文提出 DeepDelta:在 Google 收集所有构建错误及使失败构建转为成功的人类代码修改,从文本修改生成 AST diff,并转换为领域特定语言 Delta 来表示使代码通过编译所需的变化;随后将编译器诊断信息作为源、解决该诊断的 Delta 变化作为目标,训练神经机器翻译网络。针对 Java 中最常见且代价最高的两类编译错误——缺失符号和方法签名不匹配,DeepDelta 对 38,788 个未见错误中的 19,314 个(50%)生成正确修复变化,平均 86% 的情况下正确变化出现在前三个建议中。
Programmers spend a substantial amount of time manually repairing code that does not compile. We observe that the repairs for any particular error class typically follow a pattern and are highly mechanical. We propose a novel approach that automatically learns these patterns with a deep neural network and suggests program repairs for the most costly classes of build-time compilation failures. We describe how we collect all build errors and the human-authored, in-progress code changes that cause those failing builds to transition to successful builds at Google. We generate an AST diff from the textual code changes and transform it into a domain-specific language called Delta that encodes the change that must be made to make the code compile. We then feed the compiler diagnostic information (as source) and the Delta changes that resolved the diagnostic (as target) into a Neural Machine Translation network for training. For the two most prevalent and costly classes of Java compilation errors, namely missing symbols and mismatched method signatures, our system called DeepDelta, generates the correct repair changes for 19,314 out of 38,788 (50%) of unseen compilation errors. The correct changes are in the top three suggested fixes 86% of the time on average.