Skip to content

yyxhdy/defects4j-patches

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Here are the test-suite adequate patches generated by our implemented repair approaches, i.e., ARJA, GenProg, RSRepair and Kali.

The directory Defects4JPatches/alg/bugID contains the patches obtained by ''alg'' (ARJA, GenProg, RSRepair or Kali)
for the bug ''bugID''


Each patch generated by ARJA, GenProg and RSRepair is represented as a number of edits. The following is an example:

1 Replace src/main/java/org/apache/commons/math/distribution/NormalDistributionImpl.java 216 
Faulty:
ret=-Double.MAX_VALUE;
Seed:
ret=getMean();
**********************************************************************************************
2 Delete src/main/java/org/apache/commons/math/distribution/NormalDistributionImpl.java 138 
Faulty:
if (x < 0) {
  return 0;
}
Seed:
**********************************************************************************************
3 InsertBefore src/main/java/org/apache/commons/math/distribution/NormalDistributionImpl.java 172 
Faulty:
if (p == 1) {
  return Double.POSITIVE_INFINITY;
}
Seed:
if (p == 0) {
  return Double.NEGATIVE_INFINITY;
}
**********************************************************************************************


There are three edits in this patch. For each edit, this first line
contains three kinds of information: the operation types, the java file where the faulty statement locates, 
and the line number of the faulty statement in the java file. 
For example, the first edit means that replacing the faulty statement (line 216 in NormalDistributionImpl.java) with ret=-Double.MAX_VALUE;. 
The third edit means that inserting
if (p == 0) {
  return Double.NEGATIVE_INFINITY;
}
before the faulty statement (line 172 in NormalDistributionImpl.java):
if (p == 1) {
  return Double.POSITIVE_INFINITY;
}





Each patch generated by Kali is represented by a different format. There are three types of operations in Kali, which are
illustrated with examples as follows:

The first operation type is ''InsertReturn''

InsertReturn true /mnt/home/yyuan/Defects4J/Chart/chart_12_buggy/src/main/java/org/jfree/data/general/AbstractDataset.java 160 
List list=Arrays.asList(this.listenerList.getListenerList());
**********************************************************************************************

This edit means that inserting the following statement:
if (true)
	return true;
before the faulty statement List list=Arrays.asList(this.listenerList.getListenerList()); (i.e., line 160 in AbstractDataset.java).

Note that if the return type of the mehtod is numeric (i.e., int, float, double...),
''InsertReturn true'' means that insering the following statement before the faulty statement:
if (true)
	return 0;
	
''InsertReturn false''means that insering the following statement before the faulty statement:
if (true)
	return -1;
	

If the return type of the method is ''void''. ''InsertReturn'' just means inserting the following statement before the faulty statement:
if (true)
	return;
	
If the return type of the method is an object. ''InsertReturn'' just means inserting the following statement before the faulty statement:
if (true)
	return null;
	
	

The second operation type is ''RedirectBranch'', which is further divided into ''RedirectBranch false'' and ''RedirectBranch true''.

RedirectBranch false /mnt/home/yyuan/Defects4J/Math/math_2_buggy/src/main/java/org/apache/commons/math3/distribution/AbstractIntegerDistribution.java 137 
if (tmp < upper) {
  upper=((int)Math.ceil(tmp)) - 1;
}
**********************************************************************************************

This edit means that replacing the faulty statement (line 137 in AbstractIntegerDistribution.java)
if (tmp < upper) {
  upper=((int)Math.ceil(tmp)) - 1;
}
with:
if (false) {
  upper=((int)Math.ceil(tmp)) - 1;
}



RedirectBranch true /mnt/home/yyuan/Defects4J/Math/math_2_buggy/src/main/java/org/apache/commons/math3/distribution/AbstractIntegerDistribution.java 137 
if (tmp < upper) {
  upper=((int)Math.ceil(tmp)) - 1;
}
**********************************************************************************************

This edit means that replacing the faulty statement (line 137 in AbstractIntegerDistribution.java)
if (tmp < upper) {
  upper=((int)Math.ceil(tmp)) - 1;
}
with:
if (true) {
  upper=((int)Math.ceil(tmp)) - 1;
}


The third operation type is ''Delete''

Delete /mnt/home/yyuan/Defects4J/Math/math_85_buggy/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtils.java 199 1.0
throw new ConvergenceException("number of iterations={0}, maximum iterations={1}, " + "initial={2}, lower bound={3}, upper bound={4}, final a value={5}, " + "final b value={6}, f(a)={7}, f(b)={8}",numIterations,maximumIterations,initial,lowerBound,upperBound,a,b,fa,fb);
**************************************

This edit means that deleting the faulty statement throw new ConvergenceException("...") (line 199 in UnivariateRealSolverUtils.java).

	









About

Test-suite adequate patches

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published