DOI: 10.5281/zenodo.4452147
title: PEARL

description: This repository contains the artifacts of PEARL. The files <strong>prediction_CoCoNut.csv</strong> and <strong>prediction_ManySStuBs4J.csv</strong> illustrate the prediction results of <strong>BEP</strong> on the two datasets, in which the column <em>element_Rank</em> shows the ranking of buggy element and the column <em>rank</em> is for operation path. The file <strong>Pipeline_Results.zip</strong> contains the results of our repair pipeline on the 111 single-token bugs. In each folder, <em>rem.txt</em> corresponds to the buggy line, <em>add.txt</em> corresponds to the correct line, and <em>context.txt</em> corresponds to the whole buggy method. These three files are required inputs for each prediction. <em>query.txt</em> is the content sent to <em>AnyCodeGen </em>and the returned code fragment is stored in <em>result.txt</em>. We also open the cleaned dataset of ManySStuBs4J which only contains single-token bugs in <strong>Single-token_bugs_in_ManySStuBs4J.zip</strong>. In this file, each bug is corresponding to three lines with the same line number in three different files which are <em>rem.txt</em>, <em>add.txt</em>, and <em>context.txt</em>, respectively representing the buggy line, correct line, and the buggy method. This storage style follows the training set of CoCoNut. Note that we do not release our pre-processed dataset of CoCoNut sinse it is too large. We encourage researchers to process this dataset based on their own needs. Moreover, we do provide the script we used for selecting single-token bugs which is <strong>single-token_selection.py</strong>. We also note there is no visual interface for the newly added bugs in Defects4J-V2.0. We thus provide our script for selecting single-token bugs (<strong>getSingle-token_bugs_from_D4J.py</strong>) from these bugs, making it easy for others to reproduce our experiment. Finally, we release our souce code in <strong>source code.zip</strong> and will build a GitHub homepage for PEARL upon acceptance. <strong>Case study on the failure of PEARL:</strong> <strong>PEARL</strong> does not work well on method name-related fix. For the following bug (Closure-10), our BEP model successfully predicts the oracle operation path as No.2. <pre><code>- return allResultsMatch(n, MAY_BE_STRING_PREDICATE); + return anyResultsMatch(n, MAY_BE_STRING_PREDICATE);</code></pre> Nonetheless, we have to change this statement into "<strong>return ??</strong>" when querying <strong>AnyCodeGen</strong> due to the format restriction of it. Unfortunately, <strong>AnyCodeGen</strong> cannot synthesize such a detailed method call, thus leading to the failure of PEARL of repairing this bug. <strong>Case study on the high CR of PEARL:</strong> <pre><code class="language-java">// Ground-truth patch for Closure-62 if (excerpt.equals(LINE) - && 0 &lt;= charno && charno &lt; sourceExcerpt.length()) { + && 0 &lt;= charno && charno &lt;= sourceExcerpt.length()) { // An overfitting patch generated for Closure-62 by jKali - if (excerpt.equals(LINE) - && 0 &lt;= charno && charno &lt; sourceExcerpt.length()) { + if (true) {</code></pre> The ground-truth patch (also the <strong>PEARL</strong>-generated) and <strong>jKali</strong>-generated patch for the bug Closure-62 are listed. The ground-truth patch changes an operator <strong>&lt;</strong> into <strong>&lt;=</strong>. <strong>PEARL</strong> first identifies this operator and the operation type to be updated. After obtaining these information, we change the third line to <em>&& 0 &lt;= charno && ??) {</em> and send the whole method to <strong>AnyCodeGen</strong>. After computing the possibilities of possible answers, <strong>AnyCodeGen</strong> returns <em>charno &lt;= sourceExcerpt.length()</em> as the code fragment to replace ``??'' and thus we generate this correct patch. On the contrary, <strong>jKali</strong> is Java implementation of Kali. The operators implemented in it are removal of statements, modification of if conditions to <em>true</em> and <em>false</em> and so on which are too course-grained. In this example, <strong>jKali</strong> identifies the whole conditional statement and modifies the condition to <em>true</em> which leads to the overfitting patch. This case is a vivid example showing that fine-grained buggy element localization can avoid generating overfitting patch.