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

Bump junit from 4.13.1 to 4.13.2
Bumps [junit](https://github.com/junit-team/junit4) from 4.13.1 to 4.13.2.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/junit-team/junit4/releases">junit's releases</a>.</em></p>
<blockquote>
<h2>JUnit 4.13.2</h2>
<p>Please refer to the <a href="https://github.com/junit-team/junit/blob/HEAD/doc/ReleaseNotes4.13.2.md">release notes</a> for details.</p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/junit-team/junit4/commit/05fe2a64f59127c02135be22f416e91260d6ede6"><code>05fe2a6</code></a> [maven-release-plugin] prepare release r4.13.2</li>
<li><a href="https://github.com/junit-team/junit4/commit/ff57344f7171ea8b0935c4f842cacf1097266592"><code>ff57344</code></a> Add build for JDK 17-ea</li>
<li><a href="https://github.com/junit-team/junit4/commit/02aaa01b8f74c0eb496d76685ec49fddeb311087"><code>02aaa01</code></a> Improve check that thread is stopped</li>
<li><a href="https://github.com/junit-team/junit4/commit/e9a75f4be71a4d5a794ccd063522eea4b0f3194f"><code>e9a75f4</code></a> Merge test for exception type and message</li>
<li><a href="https://github.com/junit-team/junit4/commit/d27ad5259228e84c235dac24cd62f974ac0a8e1d"><code>d27ad52</code></a> Rename DelegateStatement to DelegatingStatement</li>
<li><a href="https://github.com/junit-team/junit4/commit/b83dc2e8c4ff06cf233cd347f1280bb417482985"><code>b83dc2e</code></a> Better name for test that stops statement</li>
<li><a href="https://github.com/junit-team/junit4/commit/527f3a3d0d71ad6dc66ede6f68f6fc316904ed2a"><code>527f3a3</code></a> Replace InfiniteLoop with RunForASecond</li>
<li><a href="https://github.com/junit-team/junit4/commit/2db63942882d91020b46d7333285e5c94f1d1e52"><code>2db6394</code></a> Tidy up FailOnTimeoutTest</li>
<li><a href="https://github.com/junit-team/junit4/commit/64634e1c3e357251a84278c26b73b04fc3450ea3"><code>64634e1</code></a> Update 4.13.2 release notes to document pull 1654</li>
<li><a href="https://github.com/junit-team/junit4/commit/f8ee412316b1a94d3dc35498359cc2f0ca273216"><code>f8ee412</code></a> Fix serialization of AssumptionViolatedException (<a href="https://github-redirect.dependabot.com/junit-team/junit4/issues/1654">#1654</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/junit-team/junit4/compare/r4.13.1...r4.13.2">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=junit:junit&package-manager=maven&previous-version=4.13.1&new-version=4.13.2)](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..3a7394d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,7 +29,7 @@
     <cli.version>1.4</cli.version>
 
     <!-- Test dependencies -->
-    <junit.version>4.13.1</junit.version>
+    <junit.version>4.13.2</junit.version>
   </properties>
 
   <dependencies>
@@ -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>();
+    }
+}