In the field of automated program repair, the redundancy assumption claimslarge programs contain the seeds of their own repair. However, mostredundancy-based program repair techniques do not reason about the repairingredients---the code that is reused to craft a patch. We aim to reason aboutthe repair ingredients by using code similarities to prioritize and transformstatements in a codebase for patch generation. Our approach, DeepRepair, relieson deep learning to reason about code similarities. Code fragments atwell-defined levels of granularity in a codebase can be sorted according totheir similarity to suspicious elements (i.e., code elements that containsuspicious statements) and statements can be transformed by mappingout-of-scope identifiers to similar identifiers in scope. We examined these newsearch strategies for patch generation with respect to effectiveness from theviewpoint of a software maintainer. Our comparative experiments were executedon six open-source Java projects including 374 buggy program revisions andconsisted of 19,949 trials spanning 2,616 days of computation time.DeepRepair's search strategy using code similarities generally found compilableingredients faster than the baseline, jGenProg, but this improvement neitheryielded test-adequate patches in fewer attempts (on average) nor foundsignificantly more patches than the baseline. Although the patch counts werenot statistically different, there were notable differences between the natureof DeepRepair patches and baseline patches. The results demonstrate that ourlearning-based approach finds patches that cannot be found by existingredundancy-based repair techniques.
展开▼