Repository: SpoonLabs/gumtree-spoon-ast-diff
Pull request #243 (2022-04-22 09:04:23)

Bump nexus-staging-maven-plugin from 1.6.8 to 1.6.13
Bumps nexus-staging-maven-plugin from 1.6.8 to 1.6.13.


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=org.sonatype.plugins:nexus-staging-maven-plugin&package-manager=maven&previous-version=1.6.8&new-version=1.6.13)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>


Patch:
diff --git a/pom.xml b/pom.xml
index 21fcc07..c3c4cf4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -156,7 +156,7 @@
       <plugin>
         <groupId>org.sonatype.plugins</groupId>
         <artifactId>nexus-staging-maven-plugin</artifactId>
-        <version>1.6.8</version>
+        <version>1.6.13</version>
         <extensions>true</extensions>
         <configuration>
           <serverId>ossrh</serverId>
diff --git a/src/main/java/gumtree/spoon/builder/LabelFinder.java b/src/main/java/gumtree/spoon/builder/LabelFinder.java
index 53d10c4..053a1fe 100644
--- a/src/main/java/gumtree/spoon/builder/LabelFinder.java
+++ b/src/main/java/gumtree/spoon/builder/LabelFinder.java
@@ -21,6 +21,7 @@ import spoon.reflect.code.CtVariableAccess;
 import spoon.reflect.code.CtWhile;
 import spoon.reflect.declaration.CtAnnotation;
 import spoon.reflect.declaration.CtNamedElement;
+import spoon.reflect.declaration.CtType;
 import spoon.reflect.path.CtRole;
 import spoon.reflect.reference.CtTypeReference;
 import spoon.reflect.visitor.CtInheritanceScanner;
@@ -42,7 +43,16 @@ class LabelFinder extends CtInheritanceScanner {
 
 	@Override
 	public <T> void visitCtInvocation(CtInvocation<T> invocation) {
-		label = invocation.getExecutable().getSimpleName();
+		if (invocation.getExecutable().isConstructor()) {
+			CtType<?> parentType = invocation.getParent(CtType.class);
+			if (parentType.getQualifiedName().equals(invocation.getExecutable().getDeclaringType().getQualifiedName())) {
+				label = "this";
+			} else {
+				label = "super";
+			}
+		} else {
+			label = invocation.getExecutable().getSimpleName();
+		}
 	}
 
 	@Override


Test patch:
diff --git a/src/test/java/gumtree/spoon/AstComparatorTest.java b/src/test/java/gumtree/spoon/AstComparatorTest.java
index 73176b9..6255d00 100644
--- a/src/test/java/gumtree/spoon/AstComparatorTest.java
+++ b/src/test/java/gumtree/spoon/AstComparatorTest.java
@@ -2136,4 +2136,18 @@ public class AstComparatorTest {
 		assertEquals(deleteOpt.get().getNode().toString(), moveOpt.get().getNode().toString());
 
 	}
+
+	@Test
+	public void thisAndSuperShouldResultInAnASTDiff() {
+		// arrange
+		String c3 = "class X { public  X() { this(); } }";
+		String c4 = "class X { public X() { super();} }";
+		AstComparator comparator = new AstComparator();
+
+		// act
+		Diff diff = comparator.compare(c3, c4);
+
+		// assert
+		assertTrue(diff.containsOperations(OperationKind.Update, "Invocation", "this", "super"));
+	}
 }
diff --git a/src/test/resources/examples/spoon.json b/src/test/resources/examples/spoon.json
index 4e3ae8d..9412d85 100644
--- a/src/test/resources/examples/spoon.json
+++ b/src/test/resources/examples/spoon.json
@@ -262,7 +262,7 @@
               ]
             },
             {
-              "label": "\u003cinit\u003e",
+              "label": "super",
               "type": "Invocation",
               "children": [
                 {
@@ -2500,4 +2500,4 @@
       ]
     }
   ]
-}
+}
\ No newline at end of file