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

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


[![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.2&new-version=1.6.8)](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..9172df6 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>
@@ -156,7 +156,7 @@
       <plugin>
         <groupId>org.sonatype.plugins</groupId>
         <artifactId>nexus-staging-maven-plugin</artifactId>
-        <version>1.6.2</version>
+        <version>1.6.8</version>
         <extensions>true</extensions>
         <configuration>
           <serverId>ossrh</serverId>
@@ -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>();
+    }
+}