Repository: SpoonLabs/gumtree-spoon-ast-diff
Pull request #196 (2021-09-16 09:03:33)

Bump maven-source-plugin from 2.3 to 3.2.1
Bumps [maven-source-plugin](https://github.com/apache/maven-source-plugin) from 2.3 to 3.2.1.
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/apache/maven-source-plugin/commit/a59a2e481f7d8e46f2abbd339d2d27e9b2964eba"><code>a59a2e4</code></a> [maven-release-plugin] prepare release maven-source-plugin-3.2.1</li>
<li><a href="https://github.com/apache/maven-source-plugin/commit/c954a7e8fed86efc554e401361f88cdbf4109267"><code>c954a7e</code></a> make build as reproducible as possible for now</li>
<li><a href="https://github.com/apache/maven-source-plugin/commit/d5b98783436d9bff8737b63adc566466d2d8590a"><code>d5b9878</code></a> [MSOURCES-123] set archiver reproducible mode earlier</li>
<li><a href="https://github.com/apache/maven-source-plugin/commit/258d666ee76782c5211519313803fad9a8b408e1"><code>258d666</code></a> MSOURCES-122 make output independant from OS newline</li>
<li><a href="https://github.com/apache/maven-source-plugin/commit/5b4e02fbb49beb2f3e9ce3e001054519019a76fe"><code>5b4e02f</code></a> [maven-release-plugin] prepare for next development iteration</li>
<li><a href="https://github.com/apache/maven-source-plugin/commit/2a74824f267902808e1807c7f25989a3ce333916"><code>2a74824</code></a> [maven-release-plugin] prepare release maven-source-plugin-3.2.0</li>
<li><a href="https://github.com/apache/maven-source-plugin/commit/816ebc43984dfa852f50d8ed493a45f4b2384c9c"><code>816ebc4</code></a> MSOURCES-120 fix reproducible IT: remove plugin version from pom.xml</li>
<li><a href="https://github.com/apache/maven-source-plugin/commit/32f122aa7d2183fff36043c261d0a90bd9a4130a"><code>32f122a</code></a> MSOURCES-120 make output jar file binary Reproducible</li>
<li><a href="https://github.com/apache/maven-source-plugin/commit/6e715b18fecae00ebbf9704a37a5a0a77e06d690"><code>6e715b1</code></a> [MSOURCES-95] Source JAR is re-created even if sources are not changed</li>
<li><a href="https://github.com/apache/maven-source-plugin/commit/9154e1aba763594d653bfff7c395e940ace7e095"><code>9154e1a</code></a> [maven-release-plugin] prepare for next development iteration</li>
<li>Additional commits viewable in <a href="https://github.com/apache/maven-source-plugin/compare/maven-source-plugin-2.3...maven-source-plugin-3.2.1">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=org.apache.maven.plugins:maven-source-plugin&package-manager=maven&previous-version=2.3&new-version=3.2.1)](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 dcbea3b..0e4f479 100644
--- a/pom.xml
+++ b/pom.xml
@@ -175,7 +175,7 @@
           <plugin>
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-source-plugin</artifactId>
-            <version>2.3</version>
+            <version>3.2.1</version>
             <executions>
               <execution>
                 <id>attach-sources</id>
diff --git a/src/main/java/gumtree/spoon/builder/NodeCreator.java b/src/main/java/gumtree/spoon/builder/NodeCreator.java
index 6870d80..d9eaf20 100644
--- a/src/main/java/gumtree/spoon/builder/NodeCreator.java
+++ b/src/main/java/gumtree/spoon/builder/NodeCreator.java
@@ -124,6 +124,7 @@ public class NodeCreator extends CtInheritanceScanner {
 			ITree returnType = builder.createNode("RETURN_TYPE", type.getQualifiedName());
 			returnType.setMetadata(SpoonGumTreeBuilder.SPOON_OBJECT, type);
 			type.putMetadata(SpoonGumTreeBuilder.GUMTREE_NODE, returnType);
+			computeTreeOfTypeReferences(type, returnType);
 			builder.addSiblingNode(returnType);
 		}
 


Test patch:
diff --git a/src/test/java/gumtree/spoon/TreeTest.java b/src/test/java/gumtree/spoon/TreeTest.java
index 108eee8..e24c18a 100644
--- a/src/test/java/gumtree/spoon/TreeTest.java
+++ b/src/test/java/gumtree/spoon/TreeTest.java
@@ -568,4 +568,17 @@ public class TreeTest {
 
 		assertEquals(3, superInterfaces.getDescendants().size());
 	}
+
+	@Test
+	public void test_nestedReturnTypeOfMethodShouldGetParsed() throws Exception {
+		File file = new File("src/test/resources/examples/NestedReturnType.java");
+		AstComparator comparator = new AstComparator();
+		SpoonGumTreeBuilder scanner = new SpoonGumTreeBuilder();
+		ITree root = scanner.getTree(comparator.getCtType(file));
+		ITree method = root.getDescendants().stream().filter(iTree -> iTree.getLabel().equals("getIntegers")).findFirst().get();
+
+		ITree returnType = method.getChild(0);
+		assertEquals(1, returnType.getDescendants().size());
+		assertEquals("java.lang.Integer", returnType.getChild(0).getLabel());
+	}
 }
diff --git a/src/test/resources/examples/NestedReturnType.java b/src/test/resources/examples/NestedReturnType.java
new file mode 100644
index 0000000..19bbccf
--- /dev/null
+++ b/src/test/resources/examples/NestedReturnType.java
@@ -0,0 +1,8 @@
+import java.util.ArrayList;
+import java.util.List;
+
+class NestedReturnType {
+    List<Integer> getIntegers() {
+        return new ArrayList<Integer>();
+    }
+}