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

ERROR when run on Bears-Benchmark: Problem compiling the model with compliance level #310

Open WuYff opened 3 years ago

WuYff commented 3 years ago

Hello, I running jGenProg2 on Bears-Benchmark. I can run on some bugs successfully (e.g. Bears-100), but I fail with compliance level error on other bugs (e.g. Bears-1, Bears-2).

For example, I fail on Bears-1 and the steps to reproduce are shown as below.

May I ask how can I solve this compliance level problem?

Environment:

java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)

Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /usr/local/apache-maven-3.6.3
Java version: 1.8.0_191, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-8-oracle/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.15.0-140-generic", arch: "amd64", family: "unix"

Build Astor

Create astor.jar following the steps in Getting started Astor

 git clone https://github.com/SpoonLabs/astor.git
 cd astor
 mvn install -DskipTests=true
 mvn package -DskipTests=true

Command:

java  -cp /home/yiwu/thesis/astor/target/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/yiwu/thesis/Bears/Bears-1 -dependencies /home/yiwu/thesis/Bears_dependency/Bears-1 

-dependencies /home/yiwu/thesis/Bears_dependency/Bears-1 is a directory that contains all the .jar files for a Bears bug.

Output log:

(base) yiwu@SH1:java -cp /home/yiwu/thesis/astor/target/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/yiwu/thesis/Bears/Bears-1 -dependencies /home/yiwu/thesis/Bears_dependency/Bears-1
19:57:37.452 [main] ERROR MutationSupporter - Problem compiling the model with compliance level 8
19:57:37.454 [main] ERROR MutationSupporter - Name clash: The method readValues(JsonParser, TypeReference<?>) of type ObjectMapper has the same erasure as readValues(JsonParser, TypeReference<T>) of type ObjectCodec but does not override it at /home/yiwu/thesis/Bears/Bears-1/src/main/java/com/fasterxml/jackson/databind/ObjectMapper.java:2230
spoon.compiler.ModelBuildingException: Name clash: The method readValues(JsonParser, TypeReference<?>) of type ObjectMapper has the same erasure as readValues(JsonParser, TypeReference<T>) of type ObjectCodec but does not override it at /home/yiwu/thesis/Bears/Bears-1/src/main/java/com/fasterxml/jackson/databind/ObjectMapper.java:2230
        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:866)
        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: Name clash: The method readValues(JsonParser, TypeReference<?>) of type ObjectMapper has the same erasure as readValues(JsonParser, TypeReference<T>) of type ObjectCodec but does not override it at /home/yiwu/thesis/Bears/Bears-1/src/main/java/com/fasterxml/jackson/databind/ObjectMapper.java:2230
        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:866)
        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)
19:57:40.161 [main] ERROR MutationSupporter - Error compiling: Name clash: The method readValues(JsonParser, TypeReference<?>) of type ObjectMapper has the same erasure as readValues(JsonParser, TypeReference<T>) of type ObjectCodec but does not override it at /home/yiwu/thesis/Bears/Bears-1/src/main/java/com/fasterxml/jackson/databind/ObjectMapper.java:2230
19:57:40.331 [main] ERROR MutationSupporter - Astor continues when model build fails. Classes created: 372
martinezmatias commented 3 years ago

Hi @WuYff

Astor fails when creating the application model using Spoon. By default, Astor uses Java 8. The command you pasted does not overwrite that value. Could you try with another value?

It could be the case that Spoon cannot create the model from that piece of code. A test case doing that could help to understand the problem.

Regards Matias