Skip to content
/ arja Public

Multi-Objective GP for Automated Repair of Java

License

Notifications You must be signed in to change notification settings

yyxhdy/arja

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ARJA

ARJA is a new genetic programming (GP) based program repair approach for Java. ARJA is mainly characterized by a novel patch representation for GP, multi-objective search, test filtering procedure, type matching and several strategies to reduce the search space. This tool provides the implementation of ARJA along with three previous notable repair approaches (i.e., GenProg, RSRepair and Kali).

If you use ARJA for academic purpose, please include the following citation:

Yuan Yuan and Wolfgang Banzhaf. 2018. ARJA: Automated repair of Java programs via multi-objective genetic programming. IEEE Transactions on Software Engineering (2018). https://doi.org/10.1109/TSE.2018.2874648

Requirements

  1. Java JDK 1.7
  2. Mac OS X or Linux

How to Run

Set Up

First, clone ARJA to the local computer:

$ git clone https://github.com/yyxhdy/arja

There are four subdirectories in the root directory of the tool.

  1. ../arja/src : the source code of the tool
  2. ../arja/bin : the compiled classes of the tool
  3. ../arja/lib : the dependences of the tool (including a number of .jar files)
  4. ../arja/external : the external project

Minimum Usage

Enter into the root directory of the tool:

$ cd arja

Confirm that the current version of Java is JDK 1.7 and use the following command to run:

$ java -cp lib/*:bin us.msu.cse.repair.Main Arja -DsrcJavaDir path_to_directory_of_src_buggy \
                                                 -DbinJavaDir path_to_directory_of_binary_source_buggy \
                                                 -DbinTestDir path_to_directory_of_binary_test_buggy \
                                                 -Ddependences paths_to_dependences_buggy 

"Arja" means that the repair approach ARJA is run. Alternatively, "GenProg", "RSRepair" and "Kali" can be used. Moreover, at least four parameters related with the buggy program are required.

  1. -DsrcJavaDir :  the path to the root directory of the source code
  2. -DbinJavaDir :  the path to the root directory of all the compiled classes of source code
  3. -DbinTestDir : the path to the root directory of all the compiled classes of test code
  4. -Ddependences : the paths to the dependences (jar files). If more than one, separated by ":"

In the above command, "path_to_directory_of_src_buggy" etc should be replaced with the actual absolute paths (the tool currently only supports absolute paths). All the test-suite adequate patches found by the approach are saved in the directory arja/patches_$id$ by default. $id$ is a randomly generated string containing four characters.

Advanced Usage

The tool provides the other parameters to configure the repair approaches. The following command can be used to list all the parameters (including the description) available for each repair approach.

$ java -cp lib/*:bin us.msu.cse.repair.Main -listParameters

The following is an example to use more than four parameters:

$ java -cp lib/*:bin us.msu.cse.repair.Main Arja -DsrcJavaDir path_to_directory_of_src_buggy \
                                                 -DbinJavaDir path_to_directory_of_binary_source_buggy \
                                                 -DbinTestDir path_to_directory_of_binary_test_buggy \
                                                 -Ddependences paths_to_dependences_buggy \
                                                 -DpopulationSize value_of_population_size \
                                                 -DgzoltarDataDir path_to_directory_of_Gzoltar_output \

In this command, the parameter -DpopulationSize sets the population size of ARJA to "value_of_population_size"; the parameter -DgzoltarDataDir specifies the path to the root directory of the Gzoltar 1.6.2 output (see http://www.gzoltar.com/command-line.html).

How to Build

The users can also compile the tool themselves. First, enter into the root directory of the tool and clean the original binaries:

$ cd arja
$ rm -r bin

Then, compile the source code of the tool, and the compiled classes are saved in the directory "bin":

$ mkdir bin
$ javac -cp lib/*: -d bin $(find src -name '*.java')

Similarly, the external project is compiled as follows:

$ cd external
$ rm -r bin
$ mkdir bin
$ javac -cp lib/*: -d bin $(find src -name '*.java')

Evaluation

Our implemented approaches in this tool, including ARJA, GenProg, RSRepair and Kali, have been evaluated on 224 bugs in Defects4J (https://github.com/rjust/defects4j).

The test-suite adequate patches generated by these repair approaches are available at http://github.com/yyxhdy/defects4j-patches

We manually evaluate the correctness of the patches generated by ARJA. The detailed analysis of the patch correctness is available at https://github.com/yyxhdy/arja-supplemental

Contact

For questions and feedback, please contact [email protected]