Java: When generating return statement where the returned type is an array use raw type in array creation (IDEA-163341)

This commit is contained in:
Pavel Dolgov
2017-01-30 13:37:29 +03:00
parent 853c8cb41f
commit 14b3a1b38f
8 changed files with 62 additions and 8 deletions
@@ -0,0 +1,8 @@
// "Add 'return' statement" "true"
import java.util.*;
class A<T> {
List<T>[] f(T a, T b) {
List<List<T>> list = Arrays.asList(Collections.singletonList(a), Collections.singletonList(b));
return list.toArray(new List[0]);
}
}
@@ -0,0 +1,7 @@
// "Add 'return' statement" "true"
import java.util.*;
class A<T> {
List<T>[] f() {
return new List[0];
}
}
@@ -0,0 +1,8 @@
// "Add 'return' statement" "true"
import java.util.*;
class A<T> {
Object[] f() {
List<T> list = new ArrayList<>();
return list.toArray();
}
}
@@ -0,0 +1,7 @@
// "Add 'return' statement" "true"
import java.util.*;
class A<T> {
List<T>[] f(T a, T b) {
List<List<T>> list = Arrays.asList(Collections.singletonList(a), Collections.singletonList(b));
<caret>}
}
@@ -0,0 +1,6 @@
// "Add 'return' statement" "true"
import java.util.*;
class A<T> {
List<T>[] f() {
<caret>}
}
@@ -0,0 +1,7 @@
// "Add 'return' statement" "true"
import java.util.*;
class A<T> {
Object[] f() {
List<T> list = new ArrayList<>();
<caret>}
}