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

Bump maven-compiler-plugin from 3.1 to 3.8.1
Bumps [maven-compiler-plugin](https://github.com/apache/maven-compiler-plugin) from 3.1 to 3.8.1.
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/apache/maven-compiler-plugin/commit/1b206fe40156bb9814ed8b804a23362ec2b41daa"><code>1b206fe</code></a> [maven-release-plugin] prepare release maven-compiler-plugin-3.8.1</li>
<li><a href="https://github.com/apache/maven-compiler-plugin/commit/d94a5738cc0a5318c96d848f6c492eb7fdac86c1"><code>d94a573</code></a> Revert &quot;[maven-release-plugin] prepare release maven-compiler-plugin-3.8.1&quot;</li>
<li><a href="https://github.com/apache/maven-compiler-plugin/commit/0747073abd2c10bc0be60a4e18855cc3097e7888"><code>0747073</code></a> [maven-release-plugin] prepare release maven-compiler-plugin-3.8.1</li>
<li><a href="https://github.com/apache/maven-compiler-plugin/commit/4f37195e9836c1325e4b250defb3a5cf8e680df1"><code>4f37195</code></a> Revert &quot;[maven-release-plugin] prepare release maven-compiler-plugin-3.8.1&quot;</li>
<li><a href="https://github.com/apache/maven-compiler-plugin/commit/114487b1904c5269de6223f892863356652a3f71"><code>114487b</code></a> Revert &quot;[maven-release-plugin] prepare for next development iteration&quot;</li>
<li><a href="https://github.com/apache/maven-compiler-plugin/commit/6fd3a46885edd81e62ae62cfc798c1e1b903e170"><code>6fd3a46</code></a> [MCOMPILER-379] - Fatal error compiling: basedir ... arget/generated-sources/...</li>
<li><a href="https://github.com/apache/maven-compiler-plugin/commit/a5c6bc51ecc46c3a7f857eaeff7eaf9da92fd88c"><code>a5c6bc5</code></a> (doc) Fixed broken links to scm, issue tracker, and mailing list page. (<a href="https://github-redirect.dependabot.com/apache/maven-compiler-plugin/issues/15">#15</a>)</li>
<li><a href="https://github.com/apache/maven-compiler-plugin/commit/6c576ab5812605ab90ab4b2ebd227fff8f801905"><code>6c576ab</code></a> [maven-release-plugin] prepare for next development iteration</li>
<li><a href="https://github.com/apache/maven-compiler-plugin/commit/e09eb57d1a32f0ae8d2c7cf58a65d1ad63a078b9"><code>e09eb57</code></a> [maven-release-plugin] prepare release maven-compiler-plugin-3.8.1</li>
<li><a href="https://github.com/apache/maven-compiler-plugin/commit/3d6b27cc81c3dde2d537ca3be1117d470d0017f3"><code>3d6b27c</code></a> [MCOMPILER 366] - Warning about automodules should provide the list of offend...</li>
<li>Additional commits viewable in <a href="https://github.com/apache/maven-compiler-plugin/compare/maven-compiler-plugin-3.1...maven-compiler-plugin-3.8.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-compiler-plugin&package-manager=maven&previous-version=3.1&new-version=3.8.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..9ff03fa 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>
@@ -94,7 +94,7 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-compiler-plugin</artifactId>
-        <version>3.1</version>
+        <version>3.8.1</version>
         <configuration>
           <source>${java.src.version}</source>
           <target>${java.src.version}</target>
@@ -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>();
+    }
+}