SpoonLabs / astor

Automatic program repair for Java with generate-and-validate techniques :v::v:: jGenProg (2014) - jMutRepair (2016) - jKali (2016) - DeepRepair (2017) - Cardumen (2018) - 3sfix (2018)
https://hal.archives-ouvertes.fr/hal-01321615/document
GNU General Public License v2.0
205 stars 107 forks source link

Questions about Cardumen tool. #348

Closed zqxyus closed 2 years ago

zqxyus commented 2 years ago

I have downloaded astor and built successfully. When i am trying to use Cardumen tool to repair bugs, it seems that i really works. However, while reading the source code of Cardumen , i just wonde what is the difference between the two java files ./src/main/java/fr/inria/astor/approaches/cardumholes/Cardumen1HApproach.java,
./src-cardumen/main/java/fr/inria/astor/approaches/cardumen/CardumenApproach.java , which exist in the astor directory?

According to the descriptions mentioned in the paper proposing Cardumen, Cardument mines code templates from the code of the application under repair for creating a template-based search space. The second question arises that which part of source code implements the function?

The third question is how to add manual repair templates in Cardumen? After scanning the source code, i have no idea what to do?

martinezmatias commented 2 years ago

Hi @xy-whu

while reading the source code of Cardumen , i just wonde what is the difference between the two java files ./src/main/java/fr/inria/astor/approaches/cardumholes/Cardumen1HApproach.java, ./src-cardumen/main/java/fr/inria/astor/approaches/cardumen/CardumenApproach.java , which exist in the astor directory?

The file ./src/main/java/fr/inria/astor/approaches/cardumholes/Cardumen1HApproach.java is just a prototype we did. You can ignore it and use ./src-cardumen/main/java/fr/inria/astor/approaches/cardumen/CardumenApproach.java

Cardument mines code templates from the code of the application under repair for creating a template-based search space. The second question arises that which part of source code implements the function?

In this method: https://github.com/SpoonLabs/astor/blob/bcc8463eeb00545f921f9216be694807014263ea/src-cardumen/main/java/fr/inria/astor/approaches/cardumen/CardumenApproach.java#L46

The third question is how to add manual repair templates in Cardumen?

One way would be to overwrite the method loadIngredientPool (https://github.com/SpoonLabs/astor/blob/bcc8463eeb00545f921f9216be694807014263ea/src-cardumen/main/java/fr/inria/astor/approaches/cardumen/CardumenApproach.java#L46) in order to create an Ingredient Pool with the ingredients you wish (in Cardumen, an ingredient is a 'template').

Regards

Matias