Skip to content

Commit c784eef

Browse files
committed
Using proper iterations from the delta debugger
1 parent dd7c9ad commit c784eef

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

src/main/java/edu/illinois/cs/dt/tools/fixer/CleanerFixerPlugin.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@ public class CleanerFixerPlugin extends TestPlugin {
7373
private long startTime;
7474
private boolean foundFirst;
7575

76-
// Some fields to help with counting iterations of delta debug
77-
private int iterations;
78-
7976
// Don't delete. Need a default constructor for TestPlugin
8077
public CleanerFixerPlugin() {
8178
}
@@ -853,7 +850,6 @@ private PatchResult applyFix(final List<String> failingOrder,
853850
// Minimizing cleaner code, which includes setup and teardown
854851
TestPluginPlugin.info("Going to modify " + methodToModify.methodName() + " to make failing order pass.");
855852
final List<OperationTime> elapsedTime = new ArrayList<>();
856-
this.iterations = 0;
857853
int originalsize = statementsSize(cleanerStmts);
858854
final CleanerFixerDeltaDebugger finalDebugger = new CleanerFixerDeltaDebugger(this.project, this.runner, finalHelperMethod, failingOrder, finalPrepend);
859855
final NodeList<Statement> minimalCleanerStmts = OperationTime.runOperation(() -> {
@@ -915,6 +911,8 @@ private PatchResult applyFix(final List<String> failingOrder,
915911
return finalCleanerStmts;
916912
});
917913

914+
int iterations = finalDebugger.getIterations();
915+
918916
BlockStmt patchedBlock = new BlockStmt(minimalCleanerStmts);
919917

920918
// Check that the results are valid
@@ -924,7 +922,7 @@ private PatchResult applyFix(final List<String> failingOrder,
924922
restore(finalHelperMethod.javaFile());
925923
MvnCommands.runMvnInstall(this.project, false);
926924
Path patch = writePatch(victimMethod, 0, patchedBlock, originalsize, methodToModify, cleanerMethod, polluterMethod, elapsedTime.get(0).elapsedSeconds(), "BROKEN MINIMAL");
927-
return new PatchResult(elapsedTime.get(0), FixStatus.FIX_INVALID, victimMethod.methodName(), polluterMethod != null ? polluterMethod.methodName() : "N/A", cleanerMethod.methodName(), this.iterations, patch.toString());
925+
return new PatchResult(elapsedTime.get(0), FixStatus.FIX_INVALID, victimMethod.methodName(), polluterMethod != null ? polluterMethod.methodName() : "N/A", cleanerMethod.methodName(), iterations, patch.toString());
928926
}
929927

930928
// Try to inline these statements into the method
@@ -987,7 +985,7 @@ private PatchResult applyFix(final List<String> failingOrder,
987985
// Final compile to get state to right place
988986
MvnCommands.runMvnInstall(this.project, false);
989987

990-
return new PatchResult(elapsedTime.get(0), fixStatus, victimMethod.methodName(), polluterMethod != null ? polluterMethod.methodName() : "N/A", cleanerMethod.methodName(), this.iterations, patchFile.toString());
988+
return new PatchResult(elapsedTime.get(0), fixStatus, victimMethod.methodName(), polluterMethod != null ? polluterMethod.methodName() : "N/A", cleanerMethod.methodName(), iterations, patchFile.toString());
991989
}
992990

993991
// Helper method to create a patch file adding in the passed in block

0 commit comments

Comments
 (0)