一句话:提出 NPEX,无需测试用例,通过挖掘空值处理模式推断修复规约来修复 Java NPE。
现有 Java 空指针异常(NPE)自动修复技术通常依赖开发者编写的测试套件来验证补丁,但 bug 报告时这些测试往往尚未存在,或者不足以识别正确补丁。NPEX 不需要测试用例,而是自动推断 buggy 程序的修复规约,并用该规约验证候选补丁。其核心思想是从现有代码库中挖掘空值处理模式,学习一个预测开发者如何处理 NPE 的统计模型,并使用符号执行变体结合该模型从 buggy 程序中推断修复规约。作者在多个开源项目中收集的真实 NPE 上评估 NPEX,结果表明其显著优于当前最先进技术。
We present NPEX, a new technique for repairing Java null pointer exceptions (NPEs) without tests. State-of-the-art NPE repair techniques rely on test suites written by developers for patch validation. Unfortunately, however, those are typically future test cases that are unavailable at the time bugs are reported or insufficient to identify correct patches. Unlike existing techniques, NPEX does not require test cases; instead, NPEX automatically infers the repair specification of the buggy program and uses the inferred specification to validate patches. The key idea is to learn a statistical model that predicts how developers would handle NPEs by mining null-handling patterns from existing codebases, and to use a variant of symbolic execution that can infer the repair specification from the buggy program using the model. We evaluated NPEX on real-world NPEs collected from diverse open-source projects. The results show that NPEX significantly outperforms the current state-of-the-art.