Repository: SpoonLabs/gumtree-spoon-ast-diff
Pull request #288 (2023-09-04 14:21:50)

chore(deps): update actions/checkout action to v4
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [actions/checkout](https://togithub.com/actions/checkout) | action | major | `v3` -> `v4` |

---

### Release Notes

<details>
<summary>actions/checkout (actions/checkout)</summary>

### [`v4`](https://togithub.com/actions/checkout/blob/HEAD/CHANGELOG.md#v400)

[Compare Source](https://togithub.com/actions/checkout/compare/v3...v4)

-   [Support fetching without the --progress option](https://togithub.com/actions/checkout/pull/1067)
-   [Update to node20](https://togithub.com/actions/checkout/pull/1436)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/SpoonLabs/gumtree-spoon-ast-diff).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi43OS4xIiwidXBkYXRlZEluVmVyIjoiMzYuNzkuMSIsInRhcmdldEJyYW5jaCI6Im1hc3RlciJ9-->



Patch:
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index e16ab49..740b81f 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -12,10 +12,11 @@ jobs:
   test:
     runs-on: ubuntu-latest
     steps:
-    - uses: actions/checkout@v3
+    - uses: actions/checkout@v4
     - name: Set up JDK 11
-      uses: actions/setup-java@v1
+      uses: actions/setup-java@v3
       with:
+        distribution: 'adopt'
         java-version: 11
     - name: Run test phase
       run: mvn test
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index b2f0856..99b0c47 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -19,10 +19,11 @@ jobs:
         # Reference: https://github.com/lewagon/wait-on-check-action#running-workflow-name
         running-workflow-name: 'Publish package'
         repo-token: ${{ secrets.GITHUB_TOKEN }}
-    - uses: actions/checkout@v3
+    - uses: actions/checkout@v4
     - name: Set up JDK 11
-      uses: actions/setup-java@v1
+      uses: actions/setup-java@v3
       with:
+        distribution: 'adopt'
         java-version: 11
     - name: Start deployment
       env:
diff --git a/README.md b/README.md
index 2a8dc86..e19e4e3 100644
--- a/README.md
+++ b/README.md
@@ -42,10 +42,69 @@ gumtree.spoon.AstComparator <file_1> <file_2>
 
 As API:
 
+- Diff of two Spoon AST 
+
 ```java
 new AstComparator().compare((CtElement) el1, (CtElement) el2);
 ```
 
+- Diff of two Files (It parses each file for creating a Spoon AST, then it compares both ASTs)
+
+```java
+new AstComparator().compare((File) f, (File) f2);
+```
+
+- Diff of two Snippets (It parses each Snippet for creating a Spoon AST, then it compares both ASTs)
+ 
+```java
+new AstComparator().compare((String) s1, (String) s2);
+```
+
+By default, the current version of Gumtree Spoon AST Diff uses the novel AST matcher called `SimpleGumTree`. However, the API provides the possibility to change it:  The mentioned `compare` methods can also receive the configuration of the AST diff algorithm.
+
+```java
+		AstComparator comp = new AstComparator();
+		
+		//We define a DiffConfiguration
+		DiffConfiguration diffConfiguration = new DiffConfiguration();
+		//Set the matcher to be used
+		diffConfiguration.setMatcher(new CompositeMatchers.ClassicGumtree());
+		//Set values for hyperparameters
+		GumtreeProperties properties = new GumtreeProperties();
+		properties.tryConfigure(ConfigurationOptions.bu_minsim, 0.2);
+		properties.tryConfigure(ConfigurationOptions.bu_minsize, 600);
+		properties.tryConfigure(ConfigurationOptions.st_minprio, 1);
+		properties.tryConfigure(ConfigurationOptions.st_priocalc, size);
+		diffConfiguration.setGumtreeProperties(properties);
+		
+		//Now, compute the diff with the configuration diffConfiguration
+		Diff resultClassicMatcher = comp.compare(fl, fr, diffConfiguration);
+
+```
+
+In the previous snippet, we call the diff algorithm with a particular setup: ClassicGumtree matcher and a set of hyperparameters which minimize the size of the edit-scripts.
+The values of these hyperparameters were found using [DAT (Diff Auto-Tuning)](https://github.com/martinezmatias/diff-auto-tuning).
+
+```
+@misc{dat,
+  author = {Martinez, Matias and Falleri, Jean-Rémy and Monperrus, Martin},
+  
+  title = {Hyperparameter Optimization for AST Differencing},
+  
+  publisher = {arXiv},
+  
+  year = {2020},
+  
+  doi = {10.48550/ARXIV.2011.10268},
+  
+  url = {https://arxiv.org/abs/2011.10268},
+   
+  keywords = {Software Engineering (cs.SE), FOS: Computer and information sciences, FOS: Computer and information sciences},
+}
+```
+
+
+
 
 Testing AST differencing
 ------------------------
diff --git a/src/main/java/gumtree/spoon/AstComparator.java b/src/main/java/gumtree/spoon/AstComparator.java
index ecff517..04eadcb 100644
--- a/src/main/java/gumtree/spoon/AstComparator.java
+++ b/src/main/java/gumtree/spoon/AstComparator.java
@@ -2,9 +2,6 @@ package gumtree.spoon;
 
 import java.io.File;
 import java.util.Map;
-
-import com.github.gumtreediff.matchers.GumtreeProperties;
-
 import gumtree.spoon.builder.SpoonGumTreeBuilder;
 import gumtree.spoon.diff.Diff;
 import gumtree.spoon.diff.DiffConfiguration;
@@ -27,41 +24,7 @@ import spoon.support.compiler.jdt.JDTBasedSpoonCompiler;
  * @author Matias Martinez, matias.martinez@inria.fr
  */
 public class AstComparator {
-	// For the moment, let's create a factory each type we get a type.
-	// Sharing the factory produces a bug when asking the path of different types
-	// (>1)
-	// private final Factory factory;
-
-	static {
-		// default 0.3
-		// it seems that default value is really bad
-		// 0.1 one failing much more changes
-		// 0.2 one failing much more changes
-		// 0.3 one failing test_t_224542
-		// 0.4 fails for issue31
-		// 0.5 fails for issue31
-		// 0.6 OK
-		// 0.7 1 failing
-		// 0.8 2 failing
-		// 0.9 two failing tests with more changes
-		// see GreedyBottomUpMatcher.java in Gumtree
-		System.setProperty("gt.bum.smt", "0.6");
-
-		// default 2
-		// 0 is really bad for 211903 t_224542 225391 226622
-		// 1 is required for t_225262 and t_213712 to pass
-		System.setProperty("gt.stm.mh", "1");
-
-		// default 1000
-		// 0 fails
-		// 1 fails
-		// 10 fails
-		// 100 OK
-		// 1000 OK
-		// see AbstractBottomUpMatcher#SIZE_THRESHOD in Gumtree
-		// System.setProperty("gumtree.match.bu.size","10");
-		// System.setProperty("gt.bum.szt", "1000");
-	}
+
 	/**
 	 * By default, comments are ignored
 	 */
@@ -96,36 +59,32 @@ public class AstComparator {
 	public Diff compare(File f1, File f2) throws Exception {
 		return this.compare(getCtType(f1), getCtType(f2));
 	}
-
-	/**
-	 * compares two snippets
-	 */
-	public Diff compare(String left, String right) {
-		return compare(getCtType(left), getCtType(right));
-	}
-
+	
 	/**
-	 * compares two java files
+	 * compares two AST nodes from two files according with a given configuration
 	 */
-	public Diff compare(File f1, File f2, GumtreeProperties properties) throws Exception {
-		return this.compare(getCtType(f1), getCtType(f2), properties);
+	public Diff compare(File f1, File f2, DiffConfiguration configuration) throws Exception {
+		final SpoonGumTreeBuilder scanner = new SpoonGumTreeBuilder();
+		return new DiffImpl(
+				scanner.getTreeContext(), scanner.getTree(getCtType(f1)), scanner.getTree(getCtType(f2)), configuration);
 	}
 
 	/**
 	 * compares two snippets
 	 */
-	public Diff compare(String left, String right, GumtreeProperties properties) {
-		return compare(getCtType(left), getCtType(right), properties);
+	public Diff compare(String left, String right) {
+		return compare(getCtType(left), getCtType(right));
 	}
 
 	/**
-	 * compares two snippets that come from the files given as argument
+	 * compares two snippets
 	 */
-	public Diff compare(String left, String right, String filenameLeft, String filenameRight,
-			GumtreeProperties properties) {
-		return compare(getCtType(left, filenameLeft), getCtType(right, filenameRight), properties);
+	public Diff compare(String left, String right, DiffConfiguration configuration) {
+		return compare(getCtType(left), getCtType(right),configuration);
 	}
 
+	
+	
 	/**
 	 * compares two snippets that come from the files given as argument
 	 */
@@ -141,19 +100,16 @@ public class AstComparator {
 		return new DiffImpl(scanner.getTreeContext(), scanner.getTree(left), scanner.getTree(right));
 	}
 
+	
 	/**
-	 * compares two AST nodes
+	 * compares two AST nodes according with a given configuration
 	 */
-	public Diff compare(CtElement left, CtElement right, GumtreeProperties properties) {
+	public Diff compare(CtElement left, CtElement right, DiffConfiguration configuration) {
 		final SpoonGumTreeBuilder scanner = new SpoonGumTreeBuilder();
-		return new DiffImpl(scanner.getTreeContext(), scanner.getTree(left), scanner.getTree(right), properties);
+		return new DiffImpl(scanner.getTreeContext(), scanner.getTree(left), scanner.getTree(right),configuration);
 	}
+	
 
-	public Diff compare(File f1, File f2, DiffConfiguration configuration) throws Exception {
-		final SpoonGumTreeBuilder scanner = new SpoonGumTreeBuilder();
-		return new DiffImpl(
-				scanner.getTreeContext(), scanner.getTree(getCtType(f1)), scanner.getTree(getCtType(f2)), configuration);
-	}
 
 	public CtType getCtType(File file) throws Exception {
 
diff --git a/src/main/java/gumtree/spoon/diff/DiffConfiguration.java b/src/main/java/gumtree/spoon/diff/DiffConfiguration.java
index fc99331..37a26d9 100644
--- a/src/main/java/gumtree/spoon/diff/DiffConfiguration.java
+++ b/src/main/java/gumtree/spoon/diff/DiffConfiguration.java
@@ -1,21 +1,30 @@
 package gumtree.spoon.diff;
 
+import com.github.gumtreediff.matchers.GumtreeProperties;
 import com.github.gumtreediff.matchers.Matcher;
 
 /**
- * Stores configuration to compute Diff. This is different from {@link com.github.gumtreediff.matchers.GumtreeProperties}.
- * `DiffConfiguration` stores properties which are more general in nature and are not specific to matchers.
- *
- * In the future, this class can also be wrapper to store all types of configuration, whether required by gumtree or gumtree-spoon.
+ * Stores configuration to compute Diff
  */
 public class DiffConfiguration {
-    private Matcher matcher;
+	
+	private Matcher matcher;
 
-    public Matcher getMatcher() {
-        return matcher;
-    }
+	private GumtreeProperties gumtreeProperties;
 
-    public void setMatcher(Matcher matcher) {
-        this.matcher = matcher;
-    }
+	public GumtreeProperties getGumtreeProperties() {
+		return gumtreeProperties;
+	}
+
+	public void setGumtreeProperties(GumtreeProperties gumtreeProperties) {
+		this.gumtreeProperties = gumtreeProperties;
+	}
+
+	public Matcher getMatcher() {
+		return matcher;
+	}
+
+	public void setMatcher(Matcher matcher) {
+		this.matcher = matcher;
+	}
 }
diff --git a/src/main/java/gumtree/spoon/diff/DiffImpl.java b/src/main/java/gumtree/spoon/diff/DiffImpl.java
index bdecef5..4f89f11 100644
--- a/src/main/java/gumtree/spoon/diff/DiffImpl.java
+++ b/src/main/java/gumtree/spoon/diff/DiffImpl.java
@@ -19,6 +19,7 @@ import com.github.gumtreediff.actions.model.TreeDelete;
 import com.github.gumtreediff.actions.model.TreeInsert;
 import com.github.gumtreediff.actions.model.Update;
 import com.github.gumtreediff.matchers.CompositeMatchers;
+import com.github.gumtreediff.matchers.ConfigurationOptions;
 import com.github.gumtreediff.matchers.GumtreeProperties;
 import com.github.gumtreediff.matchers.MappingStore;
 import com.github.gumtreediff.matchers.Matcher;
@@ -65,21 +66,25 @@ public class DiffImpl implements Diff {
 
 	private GumtreeProperties properties = null;
 
-	private Matcher matcher = new CompositeMatchers.ClassicGumtree();
+	private Matcher matcher = new CompositeMatchers.SimpleGumtree();
 
-	public DiffImpl(TreeContext context, Tree rootSpoonLeft, Tree rootSpoonRight, GumtreeProperties properties) {
-		this.properties = properties;
+	public DiffImpl(TreeContext context, Tree rootSpoonLeft, Tree rootSpoonRight) {
+		
+		matcher = new CompositeMatchers.SimpleGumtree();
+		properties = new GumtreeProperties();
+		properties.tryConfigure(ConfigurationOptions.st_minprio, 1);
+		properties.tryConfigure(ConfigurationOptions.st_priocalc, "size");
+		
 		computeDiff(context, rootSpoonLeft, rootSpoonRight);
 	}
 
 	public DiffImpl(TreeContext context, Tree rootSpoonLeft, Tree rootSpoonRight, DiffConfiguration configuration) {
 		this.matcher = configuration.getMatcher();
-		computeDiff(context, rootSpoonLeft, rootSpoonRight);
-	}
+		this.properties= configuration.getGumtreeProperties();
 
-	public DiffImpl(TreeContext context, Tree rootSpoonLeft, Tree rootSpoonRight) {
 		computeDiff(context, rootSpoonLeft, rootSpoonRight);
 	}
+	
 
 	public void computeDiff(TreeContext context, Tree rootSpoonLeft, Tree rootSpoonRight) {
 		if (context == null) {
@@ -88,8 +93,11 @@ public class DiffImpl implements Diff {
 		final MappingStore mappingsComp = new MappingStore(rootSpoonLeft, rootSpoonRight);
 		this.context = context;
 
-		if (properties != null)
+	
+		if (properties != null) {
 			matcher.configure(properties);
+		}
+	
 		MappingStore mappings = matcher.match(rootSpoonLeft, rootSpoonRight, mappingsComp);
 
 		// all actions


Test patch:
diff --git a/src/test/java/gumtree/spoon/AstComparatorTest.java b/src/test/java/gumtree/spoon/AstComparatorTest.java
index 16fbe27..cdd0c44 100644
--- a/src/test/java/gumtree/spoon/AstComparatorTest.java
+++ b/src/test/java/gumtree/spoon/AstComparatorTest.java
@@ -2,6 +2,7 @@ package gumtree.spoon;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
@@ -16,13 +17,13 @@ import org.junit.Ignore;
 import org.junit.Test;
 
 import com.github.gumtreediff.actions.model.Move;
-import com.github.gumtreediff.matchers.ConfigurationOptions;
-import com.github.gumtreediff.matchers.GumtreeProperties;
+import com.github.gumtreediff.matchers.CompositeMatchers;
 import com.github.gumtreediff.matchers.Mapping;
 
 import gumtree.spoon.builder.SpoonGumTreeBuilder;
 import gumtree.spoon.diff.ActionClassifier;
 import gumtree.spoon.diff.Diff;
+import gumtree.spoon.diff.DiffConfiguration;
 import gumtree.spoon.diff.DiffImpl;
 import gumtree.spoon.diff.operations.DeleteOperation;
 import gumtree.spoon.diff.operations.InsertOperation;
@@ -408,23 +409,32 @@ public class AstComparatorTest {
 		// src/test/resources/examples/t_211903/right_MemberFilePersister_1.5.java
 		File fl = new File("src/test/resources/examples/t_211903/left_MemberFilePersister_1.4.java");
 		File fr = new File("src/test/resources/examples/t_211903/right_MemberFilePersister_1.5.java");
-		Diff result = diff.compare(fl, fr);
-
+		Diff resultDefault = diff.compare(fl, fr);
+		
+		
+		DiffConfiguration diffConfiguration = new DiffConfiguration();
+		diffConfiguration.setMatcher(new CompositeMatchers.ClassicGumtree());
+		
+		Diff resultClassicMatcher = diff.compare(fl, fr, diffConfiguration);
+		
+		// We check that the property has an effect on the edit script
+		assertNotEquals(resultClassicMatcher.getAllOperations().size(), resultDefault.getAllOperations().size());
+		
 		// result.debugInformation();
 
-		CtElement ancestor = result.commonAncestor();
+		CtElement ancestor = resultClassicMatcher.commonAncestor();
 		assertTrue(ancestor instanceof CtConstructorCall);
 		assertEquals(88, ancestor.getPosition().getLine());
 
-		List<Operation> actions = result.getRootOperations();
+		List<Operation> actions = resultClassicMatcher.getRootOperations();
 		// result.debugInformation();
 		assertTrue(
-				result.containsOperation(OperationKind.Update, "ConstructorCall", "java.io.FileReader(java.io.File)"));
-		assertTrue(result.containsOperation(OperationKind.Insert, "ConstructorCall",
+				resultClassicMatcher.containsOperation(OperationKind.Update, "ConstructorCall", "java.io.FileReader(java.io.File)"));
+		assertTrue(resultClassicMatcher.containsOperation(OperationKind.Insert, "ConstructorCall",
 				"java.io.InputStreamReader(java.io.InputStream,java.lang.String)"));
 
 		// additional checks on low-level actions
-		assertTrue(result.containsOperations(result.getAllOperations(), OperationKind.Insert, "Literal", "\"UTF-8\""));
+		assertTrue(resultClassicMatcher.containsOperations(resultClassicMatcher.getAllOperations(), OperationKind.Insert, "Literal", "\"UTF-8\""));
 
 		// the change is in the local variable declaration
 		CtElement elem = actions.get(0).getNode();
@@ -562,13 +572,8 @@ public class AstComparatorTest {
 		File fl = new File("src/test/resources/examples/t_221343/left_Server_1.186.java");
 		File fr = new File("src/test/resources/examples/t_221343/right_Server_1.187.java");
 
-		GumtreeProperties properties = new GumtreeProperties();
-
-		properties = new GumtreeProperties();
-		// Using min = 1, the imports and package declaration are mapped.
-		properties.tryConfigure(ConfigurationOptions.st_minprio, 0);
+		Diff result = diff.compare(fl, fr);
 
-		Diff result = diff.compare(fl, fr, properties);
 
 		List<Operation> actions = result.getRootOperations();
 		result.debugInformation();
@@ -586,14 +591,9 @@ public class AstComparatorTest {
 		File fl = new File("src/test/resources/examples/t_221345/left_Server_1.187.java");
 		File fr = new File("src/test/resources/examples/t_221345/right_Server_1.188.java");
 
-		GumtreeProperties properties = new GumtreeProperties();
-
-		properties = new GumtreeProperties();
-		// Using min = 1, the imports and package declaration are mapped.
-		properties.tryConfigure(ConfigurationOptions.st_minprio, 0);
-
-		Diff result = diff.compare(fl, fr, properties);
+		Diff result = diff.compare(fl, fr);
 
+		
 		List<Operation> actions = result.getRootOperations();
 		result.debugInformation();
 		assertEquals(actions.size(), 1);
@@ -742,13 +742,8 @@ public class AstComparatorTest {
 		File fl = new File("src/test/resources/examples/t_223056/left_Server_1.646.java");
 		File fr = new File("src/test/resources/examples/t_223056/right_Server_1.647.java");
 
-		GumtreeProperties properties = new GumtreeProperties();
-
-		properties = new GumtreeProperties();
-
-		properties.tryConfigure(ConfigurationOptions.st_minprio, 0);
+		Diff result = diff.compare(fl, fr);
 
-		Diff result = diff.compare(fl, fr, properties);
 
 		CtElement ancestor = result.commonAncestor();
 		assertTrue(ancestor instanceof CtClass);
@@ -768,12 +763,8 @@ public class AstComparatorTest {
 		File fl = new File("src/test/resources/examples/t_223118/left_TestBot_1.48.java");
 		File fr = new File("src/test/resources/examples/t_223118/right_TestBot_1.49.java");
 
-		GumtreeProperties properties = new GumtreeProperties();
-		properties = new GumtreeProperties();
-
-		properties.tryConfigure(ConfigurationOptions.st_minprio, 0);
+		Diff result = diff.compare(fl, fr);
 
-		Diff result = diff.compare(fl, fr, properties);
 
 		List<Operation> actions = result.getRootOperations();
 		result.debugInformation();
@@ -840,12 +831,8 @@ public class AstComparatorTest {
 		File fl = new File("src/test/resources/examples/t_224542/left_TestBot_1.75.java");
 		File fr = new File("src/test/resources/examples/t_224542/right_TestBot_1.76.java");
 
-		GumtreeProperties properties = new GumtreeProperties();
-		properties = new GumtreeProperties();
-
-		properties.tryConfigure(ConfigurationOptions.st_minprio, 0);
+		Diff result = diff.compare(fl, fr);
 
-		Diff result = diff.compare(fl, fr, properties);
 
 		result.debugInformation();
 
@@ -1139,12 +1126,9 @@ public class AstComparatorTest {
 		File fl = new File("src/test/resources/examples/t_225391/left_IndexHTML_1.4.java");
 		File fr = new File("src/test/resources/examples/t_225391/right_IndexHTML_1.5.java");
 
-		GumtreeProperties properties = new GumtreeProperties();
-		properties = new GumtreeProperties();
-
-		properties.tryConfigure(ConfigurationOptions.st_minprio, 1);
+		
 
-		Diff result = diff.compare(fl, fr, properties);
+		Diff result = diff.compare(fl, fr);
 
 		List<Operation> actions = result.getRootOperations();
 		result.debugInformation();
@@ -1239,12 +1223,9 @@ public class AstComparatorTest {
 		// src/test/resources/examples/t_226145/right_ScarabRequestTool_1.91.java
 		File fl = new File("src/test/resources/examples/t_226145/left_ScarabRequestTool_1.90.java");
 		File fr = new File("src/test/resources/examples/t_226145/right_ScarabRequestTool_1.91.java");
-		GumtreeProperties properties = new GumtreeProperties();
-		properties = new GumtreeProperties();
 
-		properties.tryConfigure(ConfigurationOptions.st_minprio, 0);
+		Diff result = diff.compare(fl, fr);
 
-		Diff result = diff.compare(fl, fr, properties);
 
 		List<Operation> actions = result.getRootOperations();
 		result.debugInformation();
@@ -1274,12 +1255,9 @@ public class AstComparatorTest {
 		// src/test/resources/examples/t_226480/right_ScarabRequestTool_1.114.java
 		File fl = new File("src/test/resources/examples/t_226480/left_ScarabRequestTool_1.113.java");
 		File fr = new File("src/test/resources/examples/t_226480/right_ScarabRequestTool_1.114.java");
-		GumtreeProperties properties = new GumtreeProperties();
-		properties = new GumtreeProperties();
 
-		properties.tryConfigure(ConfigurationOptions.st_minprio, 0);
+		Diff result = diff.compare(fl, fr);
 
-		Diff result = diff.compare(fl, fr, properties);
 		List<Operation> actions = result.getRootOperations();
 		result.debugInformation();
 		assertEquals(1, actions.size());
@@ -1361,12 +1339,9 @@ public class AstComparatorTest {
 		// src/test/resources/examples/t_226963/right_Issue_1.141.java
 		File fl = new File("src/test/resources/examples/t_226963/left_Issue_1.140.java");
 		File fr = new File("src/test/resources/examples/t_226963/right_Issue_1.141.java");
-		GumtreeProperties properties = new GumtreeProperties();
-		properties = new GumtreeProperties();
 
-		properties.tryConfigure(ConfigurationOptions.st_minprio, 0);
+		Diff result = diff.compare(fl, fr);
 
-		Diff result = diff.compare(fl, fr, properties);
 		List<Operation> actions = result.getRootOperations();
 		result.debugInformation();
 		assertEquals(1, actions.size());
@@ -1380,12 +1355,9 @@ public class AstComparatorTest {
 		// src/test/resources/examples/t_227005/right_AttributeValue_1.57.java
 		File fl = new File("src/test/resources/examples/t_227005/left_AttributeValue_1.56.java");
 		File fr = new File("src/test/resources/examples/t_227005/right_AttributeValue_1.57.java");
-		GumtreeProperties properties = new GumtreeProperties();
-		properties = new GumtreeProperties();
 
-		properties.tryConfigure(ConfigurationOptions.st_minprio, 0);
+		Diff result = diff.compare(fl, fr);
 
-		Diff result = diff.compare(fl, fr, properties);
 		List<Operation> actions = result.getRootOperations();
 		result.debugInformation();
 		assertEquals(2, actions.size());
@@ -1415,12 +1387,9 @@ public class AstComparatorTest {
 		// src/test/resources/examples/t_227368/right_IssueTemplateInfo_1.13.java
 		File fl = new File("src/test/resources/examples/t_227368/left_IssueTemplateInfo_1.12.java");
 		File fr = new File("src/test/resources/examples/t_227368/right_IssueTemplateInfo_1.13.java");
-		GumtreeProperties properties = new GumtreeProperties();
-		properties = new GumtreeProperties();
 
-		properties.tryConfigure(ConfigurationOptions.st_minprio, 1);
+		Diff result = diff.compare(fl, fr);
 
-		Diff result = diff.compare(fl, fr, properties);
 		List<Operation> actions = result.getAllOperations();
 		result.debugInformation();
 		assertEquals(1, actions.size());
@@ -1454,12 +1423,9 @@ public class AstComparatorTest {
 		// src/test/resources/examples/t_227985/right_IssueSearch_1.66.java
 		File fl = new File("src/test/resources/examples/t_227985/left_IssueSearch_1.65.java");
 		File fr = new File("src/test/resources/examples/t_227985/right_IssueSearch_1.66.java");
-		GumtreeProperties properties = new GumtreeProperties();
-		properties = new GumtreeProperties();
 
-		properties.tryConfigure(ConfigurationOptions.st_minprio, 0);
+		Diff result = diff.compare(fl, fr);
 
-		Diff result = diff.compare(fl, fr, properties);
 		List<Operation> actions = result.getRootOperations();
 		result.debugInformation();
 		assertEquals(1, actions.size());
@@ -1548,12 +1514,9 @@ public class AstComparatorTest {
 		// src/test/resources/examples/issue31/patched.java
 		File fl = new File("src/test/resources/examples/issue31/original.java");
 		File fr = new File("src/test/resources/examples/issue31/patched.java");
-		GumtreeProperties properties = new GumtreeProperties();
-		properties = new GumtreeProperties();
 
-		properties.tryConfigure(ConfigurationOptions.st_minprio, 0);
+		Diff result = diff.compare(fl, fr);
 
-		Diff result = diff.compare(fl, fr, properties);
 		List<Operation> rootActions = result.getRootOperations();
 		// result.debugInformation();
 		System.out.println("root: " + result.getRootOperations().size());
@@ -1659,12 +1622,9 @@ public class AstComparatorTest {
 		AstComparator diff = new AstComparator();
 		File fl = new File("src/test/resources/examples/vs/06b994/VerificationHost/VerificationHost_s.java");
 		File fr = new File("src/test/resources/examples/vs/06b994/VerificationHost/VerificationHost_t.java");
-		GumtreeProperties properties = new GumtreeProperties();
-		properties = new GumtreeProperties();
 
-		properties.tryConfigure(ConfigurationOptions.st_minprio, 0);
+		Diff result = diff.compare(fl, fr);
 
-		Diff result = diff.compare(fl, fr, properties);
 
 		List<Operation> actions = result.getRootOperations();
 		assertNotNull(actions);
@@ -1680,12 +1640,9 @@ public class AstComparatorTest {
 
 		File fl = new File("src/test/resources/examples/vs/06b994/TestUtilityService/TestUtilityService_s.java");
 		File fr = new File("src/test/resources/examples/vs/06b994/TestUtilityService/TestUtilityService_t.java");
-		GumtreeProperties properties = new GumtreeProperties();
-		properties = new GumtreeProperties();
 
-		properties.tryConfigure(ConfigurationOptions.st_minprio, 0);
+		Diff result = diff.compare(fl, fr);
 
-		Diff result = diff.compare(fl, fr, properties);
 		List<Operation> actions = result.getRootOperations();
 		assertNotNull(actions);
 		assertTrue(actions.size() > 0);
@@ -1902,12 +1859,9 @@ public class AstComparatorTest {
 		AstComparator diff = new AstComparator();
 		File fl = new File("src/test/resources/examples/d4j/Math_34/ListPopulation/Math_34_ListPopulation_s.java");
 		File fr = new File("src/test/resources/examples/d4j/Math_34/ListPopulation/Math_34_ListPopulation_t.java");
-		GumtreeProperties properties = new GumtreeProperties();
-		properties = new GumtreeProperties();
 
-		properties.tryConfigure(ConfigurationOptions.st_minprio, 0);
+		Diff result = diff.compare(fl, fr);
 
-		Diff result = diff.compare(fl, fr, properties);
 		List<Operation> actions = result.getAllOperations();
 		assertEquals(5, actions.size());
 
@@ -1992,12 +1946,9 @@ public class AstComparatorTest {
 				+ "};";
 
 		AstComparator diff = new AstComparator();
-		GumtreeProperties properties = new GumtreeProperties();
-		properties = new GumtreeProperties();
-
-		properties.tryConfigure(ConfigurationOptions.st_minprio, 0);
+	
 
-		Diff editScript = diff.compare(c1, c2, properties);
+		Diff editScript = diff.compare(c1, c2);
 
 		assertEquals(1, editScript.getRootOperations().size());
 
diff --git a/src/test/java/gumtree/spoon/TreeTest.java b/src/test/java/gumtree/spoon/TreeTest.java
index df5bbe2..927a86d 100644
--- a/src/test/java/gumtree/spoon/TreeTest.java
+++ b/src/test/java/gumtree/spoon/TreeTest.java
@@ -32,8 +32,6 @@ import org.junit.Test;
 
 import com.github.gumtreediff.io.TreeIoUtils;
 import com.github.gumtreediff.io.TreeIoUtils.TreeSerializer;
-import com.github.gumtreediff.matchers.ConfigurationOptions;
-import com.github.gumtreediff.matchers.GumtreeProperties;
 import com.github.gumtreediff.tree.Tree;
 import com.github.gumtreediff.tree.TreeContext;
 import com.google.gson.JsonObject;
@@ -387,12 +385,8 @@ public class TreeTest {
 
 		assertNotNull(astRight);
 
-		GumtreeProperties properties = new GumtreeProperties();
-		properties = new GumtreeProperties();
-		// Using min = 1, failing
-		properties.tryConfigure(ConfigurationOptions.st_minprio, 0);
 
-		DiffImpl diffC = (DiffImpl) diff.compare(astLeft, astRight, properties);
+		DiffImpl diffC = (DiffImpl) diff.compare(astLeft, astRight);
 
 		TreeContext context = diffC.getContext();
 
@@ -435,13 +429,9 @@ public class TreeTest {
 
 		AstComparator diff = new AstComparator();
 
-		GumtreeProperties properties = new GumtreeProperties();
-		properties = new GumtreeProperties();
-		// Using min = 1, failing
-		properties.tryConfigure(ConfigurationOptions.st_minprio, 0);
-
-		DiffImpl diffC = (DiffImpl) diff.compare(fl, fr, properties);
+		DiffImpl diffC = (DiffImpl) diff.compare(fl, fr);
 
+		
 		List<Operation> ops = diffC.getAllOperations();
 
 		// to change a method to static means to change the type accesses that invoke
@@ -472,13 +462,9 @@ public class TreeTest {
 
 		AstComparator diff = new AstComparator();
 
-		GumtreeProperties properties = new GumtreeProperties();
-		properties = new GumtreeProperties();
-		// Using min = 1, failing
-		properties.tryConfigure(ConfigurationOptions.st_minprio, 0);
-
-		DiffImpl diffC = (DiffImpl) diff.compare(fl, fr, properties);
+		DiffImpl diffC = (DiffImpl) diff.compare(fl, fr);
 
+		
 		List<Operation> ops = diffC.getAllOperations();
 		assertEquals(1, ops.size());
 		System.out.println(ops);
diff --git a/src/test/java/gumtree/spoon/diff/DiffTest.java b/src/test/java/gumtree/spoon/diff/DiffTest.java
index aa71bed..f5c68fb 100644
--- a/src/test/java/gumtree/spoon/diff/DiffTest.java
+++ b/src/test/java/gumtree/spoon/diff/DiffTest.java
@@ -268,8 +268,11 @@ public class DiffTest {
 		File left = new File("src/test/resources/examples/superInterfaces/class/left.java");
 		File right = new File("src/test/resources/examples/superInterfaces/class/right.java");
 
-		Diff diff = new AstComparator().compare(left, right);
-
+		DiffConfiguration configuration = new DiffConfiguration();
+		configuration.setMatcher(new CompositeMatchers.ClassicGumtree());
+		
+		Diff diff = new AstComparator().compare(left, right, configuration);
+		
 		assertTrue(diff.containsOperation(OperationKind.Insert, "INTERFACE", "A"));
 		assertTrue(diff.containsOperation(OperationKind.Insert, "INTERFACE", "D"));
 		assertTrue(diff.containsOperation(OperationKind.Insert, "TYPE_ARGUMENT", "T"));
@@ -285,7 +288,10 @@ public class DiffTest {
 		File left = new File("src/test/resources/examples/superInterfaces/interface/left.java");
 		File right = new File("src/test/resources/examples/superInterfaces/interface/right.java");
 
-		Diff diff = new AstComparator().compare(left, right);
+		DiffConfiguration configuration = new DiffConfiguration();
+		configuration.setMatcher(new CompositeMatchers.ClassicGumtree());
+		
+		Diff diff = new AstComparator().compare(left, right, configuration);
 
 		assertTrue(diff.containsOperation(OperationKind.Delete, "INTERFACE", "A"));
 		assertTrue(diff.containsOperation(OperationKind.Insert, "INTERFACE", "D"));