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
207 stars 106 forks source link

Can not produce source code repairs #365

Closed ruizhengu closed 1 year ago

ruizhengu commented 1 year ago

Astor can produce class file repairs but can not produce source code level repairs. image image

martinezmatias commented 1 year ago

Hello, Could you show me the printed output?

ruizhengu commented 1 year ago

Adding to classpath javaparser-core-serialization-3.25.1.jar Adding to classpath junit-vintage-engine-5.9.0.jar Adding to classpath javaparser-core-3.25.1.jar Adding to classpath junit-jupiter-engine-5.9.0.jar Adding to classpath apiguardian-api-1.1.2.jar Adding to classpath commons-lang3-3.0.jar Adding to classpath junit-4.13.2.jar Adding to classpath junit-jupiter-api-5.9.0.jar Creating model, Code location from working folder: /home/ruizhen/Projects/SSBSE/Cafe/com1003_cafe_8/src/main building model: /home/ruizhen/Projects/SSBSE/Cafe/com1003_cafe_8/src/main, compliance level: 8 Classpath (Dependencies) for building SpoonModel: [/home/ruizhen/Projects/SSBSE/Cafe/dependency/, /home/ruizhen/Projects/SSBSE/Cafe/dependency/javaparser-core-serialization-3.25.1.jar, /home/ruizhen/Projects/SSBSE/Cafe/dependency/junit-vintage-engine-5.9.0.jar, /home/ruizhen/Projects/SSBSE/Cafe/dependency/javaparser-core-3.25.1.jar, /home/ruizhen/Projects/SSBSE/Cafe/dependency/junit-jupiter-engine-5.9.0.jar, /home/ruizhen/Projects/SSBSE/Cafe/dependency/apiguardian-api-1.1.2.jar, /home/ruizhen/Projects/SSBSE/Cafe/dependency/commons-lang3-3.0.jar, /home/ruizhen/Projects/SSBSE/Cafe/dependency/junit-4.13.2.jar, /home/ruizhen/Projects/SSBSE/Cafe/dependency/junit-jupiter-api-5.9.0.jar] Spoon Model built from location: /home/ruizhen/Projects/SSBSE/Cafe/com1003_cafe_8/src/main nr test results 120 ---MP=uk.ac.sheffield.com1003.cafe.Cafe line: 110, pointed element: CtReturnImpl ---OP_INSTANCE: InsertAfterOp:(spoon.support.reflect.code.CtIfImpl)if (menu[i] != null) { actualMenu[next] = menu[i]; next++; } -topatch-->return null(spoon.support.reflect.code.CtReturnImpl) ---MP=uk.ac.sheffield.com1003.cafe.ingredients.Coffee line: 29, pointed element: CtReturnImpl ---OP_INSTANCE: ReplaceOp:(spoon.support.reflect.code.CtReturnImpl)return false -topatch-->return false(spoon.support.reflect.code.CtReturnImpl) ---MP=uk.ac.sheffield.com1003.cafe.Cafe line: 72, pointed element: CtAssignmentImpl ---OP_INSTANCE: InsertBeforeOp:(spoon.support.reflect.code.CtAssignmentImpl)menu[i] = newRecipe -topatch-->menu[i] = null(spoon.support.reflect.code.CtAssignmentImpl) ---MP=uk.ac.sheffield.com1003.cafe.Cafe line: 68, pointed element: CtLocalVariableImpl ---OP_INSTANCE: ReplaceOp:(spoon.support.reflect.code.CtLocalVariableImpl)int i = 0 -topatch-->uk.ac.sheffield.com1003.cafe.Recipe[] actualMenu = new uk.ac.sheffield.com1003.cafe.Recipe[nRecipes](spoon.support.reflect.code.CtLocalVariableImpl) ---MP=uk.ac.sheffield.com1003.cafe.Cafe line: 90, pointed element: CtLocalVariableImpl ---OP_INSTANCE: InsertAfterOp:(spoon.support.reflect.code.CtWhileImpl)while (i < menu.length) { if ((menu[i] != null) && menu[i].getName().equals(recipeName)) { nRecip[...] -topatch-->uk.ac.sheffield.com1003.cafe.Recipe[] actualMenu = new uk.ac.sheffield.com1003.cafe.Recipe[nRecipes](spoon.support.reflect.code.CtLocalVariableImpl) ---MP=uk.ac.sheffield.com1003.cafe.ingredients.Water line: 22, pointed element: CtInvocationImpl ---OP_INSTANCE: InsertBeforeOp:(spoon.support.reflect.code.CtIfImpl)if ((another == null) || (!(another instanceof uk.ac.sheffield.com1003.cafe.ingredients.Water))) { [...] -topatch-->this(8)(spoon.support.reflect.code.CtInvocationImpl)

ruizhengu commented 1 year ago

Hi, there are the output

Astor Output:

General stats: EXECUTION_IDENTIFIER= TOTAL_TIME=650.337 NR_GENERATIONS=200 NR_RIGHT_COMPILATIONS=151 NR_FAILLING_COMPILATIONS=49 NR_ERRONEOUS_VARIANCES=null NR_FAILING_VALIDATION_PROCESS=null OUTPUT_STATUS=MAX_GENERATION FAULT_LOCALIZATION=gzoltar

ruizhengu commented 1 year ago

I found that if there is no patch generated (i.e. the list patches is empty in _/output_astor/AstorMain-xxx/astoroutput.json), there will be no source code generated in _/outputastor/AstorMain-xxx/src/variant-x (but it will still be class files in _/outputastor/AstorMain-xxx/bin/variant-x).