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

HELP - ERROR MutationSupporter #318

Open juliamanfrindias opened 3 years ago

juliamanfrindias commented 3 years ago

When I run the command using the lang_63 example:

java -cp astor-1.1.0-jar-with-dependencies.jar fr.inria.main.evolution.AstorMain -mode jgenprog -srcjavafolder /src/java/ -srctestfolder /src/test/ -binjavafolder /target/classes/ - bintestfolder /target/test-classes/ -location /home/astor/Documents/A3/astor/examples/lang_63/

Returns the error:


22:04:49.451 [main] ERROR MutationSupporter - Problem compiling the model with compliance level 8
22:04:49.452 [main] ERROR MutationSupporter - Syntax error on token "enum", Identifier expected at /home/astor/Documentos/A3/astor/examples/lang_63/src/main/java/org/apache/commons/lang/enum/Enum.java:17
spoon.compiler.ModelBuildingException: Syntax error on token "enum", Identifier expected at /home/astor/Documentos/A3/astor/examples/lang_63/src/main/java/org/apache/commons/lang/enum/Enum.java:17
    at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.report(JDTBasedSpoonCompiler.java:635)
    at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.reportProblems(JDTBasedSpoonCompiler.java:617)
    at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.build(JDTBasedSpoonCompiler.java:116)
    at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.build(JDTBasedSpoonCompiler.java:97)
    at fr.inria.astor.core.manipulation.MutationSupporter.buildModel(MutationSupporter.java:85)
    at fr.inria.astor.core.manipulation.MutationSupporter.buildSpoonModel(MutationSupporter.java:240)
    at fr.inria.astor.core.solutionsearch.AstorCoreEngine.initModel(AstorCoreEngine.java:776)
    at fr.inria.main.evolution.AstorMain.createEngine(AstorMain.java:113)
    at fr.inria.main.evolution.AstorMain.run(AstorMain.java:173)
    at fr.inria.main.evolution.AstorMain.execute(AstorMain.java:233)
    at fr.inria.main.evolution.AstorMain.main(AstorMain.java:204)
spoon.compiler.ModelBuildingException: Syntax error on token "enum", Identifier expected at /home/astor/Documentos/A3/astor/examples/lang_63/src/main/java/org/apache/commons/lang/enum/Enum.java:17
    at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.report(JDTBasedSpoonCompiler.java:635)
    at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.reportProblems(JDTBasedSpoonCompiler.java:617)
    at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.build(JDTBasedSpoonCompiler.java:116)
    at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.build(JDTBasedSpoonCompiler.java:97)
    at fr.inria.astor.core.manipulation.MutationSupporter.buildModel(MutationSupporter.java:85)
    at fr.inria.astor.core.manipulation.MutationSupporter.buildSpoonModel(MutationSupporter.java:253)
    at fr.inria.astor.core.solutionsearch.AstorCoreEngine.initModel(AstorCoreEngine.java:776)
    at fr.inria.main.evolution.AstorMain.createEngine(AstorMain.java:113)
    at fr.inria.main.evolution.AstorMain.run(AstorMain.java:173)
    at fr.inria.main.evolution.AstorMain.execute(AstorMain.java:233)
    at fr.inria.main.evolution.AstorMain.main(AstorMain.java:204)
22:04:51.504 [main] ERROR MutationSupporter - Error compiling: Syntax error on token "enum", Identifier expected at /home/astor/Documentos/A3/astor/examples/lang_63/src/main/java/org/apache/commons/lang/enum/Enum.java:17
22:04:51.618 [main] ERROR MutationSupporter - Astor continues when model build fails. Classes created: 77
martinezmatias commented 3 years ago

Hi @juliamanfrindias

The code from the bug you want to repair would be compiled with 1.4 compliance. Astor provides a parameter for specifying the compliance level. By default, it uses compliance level 8. For this reason, it fails when compiling that code ( enum is not a valid identifier since Java 1.5).

Regards Matias