gumtree-spoon-ast-diff icon indicating copy to clipboard operation
gumtree-spoon-ast-diff copied to clipboard

Wrong edit scripts

Open zqxyus opened this issue 2 years ago • 8 comments

When applying gumtree-spoon-ast diff to extract the edit scripts between buggy file and fixed one in Defects4j Chart 14, the edit scripts returned have some wrong or meaningless edit script. Specifically, when using gun diff , its result is xy@xy-ThinkStation-P320:~/defects/chart/chart_14_buggy$ diff source/org/jfree/chart/plot/CategoryPlot.java ../chart_14_fix/source/org/jfree/chart/plot/CategoryPlot.java 2165a2166,2168

    if (markers == null) {
        return false;
    }

2446a2450,2452

    }
    if (markers == null) {
        return false;

However, gumtree-spoon-ast-diff gives the following edit scripts:

Delete TypeReference at org.jfree.chart.plot.XYPlot:277 org.jfree.chart.plot.Plot Insert TypeReference at org.jfree.chart.plot.XYPlot:277 org.jfree.chart.plot.Plot Insert If at org.jfree.chart.plot.XYPlot:2293 if (markers == null) { return false; } Insert If at org.jfree.chart.plot.XYPlot:2532 if (markers == null) { return false; }

zqxyus avatar Mar 03 '22 14:03 zqxyus

Hi @xy-whu ! Thank you for the potential bug report. It is a bit unclear to me diff of which two files are being computed here. Could you please share the link of the commit or the pull request where the two files can be found?

algomaster99 avatar Mar 03 '22 22:03 algomaster99

file links: https://github.com/program-repair/defects4j-dissection/commit/d7b7936

zqxyus avatar Mar 03 '22 22:03 zqxyus

@xy-whu I am sorry I am reverting to this quite late. I completely missed this issue and forgot to follow-up on your comment.

The edit script is indeed a bit weird with the redundant deletion and insertion of TypeReference. I do not have the time to fix this right now, but I will keep this on my to-do list. If your purpose is still pending, I would recommend you to try out https://github.com/GumTreeDiff/gumtree which is much more stable than this project.

algomaster99 avatar Mar 29 '22 09:03 algomaster99

One more instance of this bug. Redundant insertion and deletion of SUPER_TYPE is being reported.

algomaster99 avatar Mar 29 '22 10:03 algomaster99

@algomaster99 I have the same problem, especially in the TypeReference, which usually have extra insert and delete operation

xzm2000 avatar Apr 05 '22 13:04 xzm2000

@xzm2000 could you please provide test cases? It will be helpful while I debug it.

algomaster99 avatar Apr 05 '22 13:04 algomaster99

@xzm2000 could you please provide test cases? It will be helpful while I debug it.

I don't know whether it's a bug, because https://github.com/GumTreeDiff/gumtree gives the same result, has extra operation(insert and delete). I will upload the test case soon

xzm2000 avatar Apr 08 '22 04:04 xzm2000

There could ve a bug in gumtree as well. I will investigate when I get time. Thanks for the test cases.

algomaster99 avatar Apr 08 '22 08:04 algomaster99