mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-30 18:28:55 +07:00
IDEA-113585 Cast to Type quick fix creates code that doesn't help
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
// "Apply conversion '.toArray(new Test.User[0])'" "true"
|
||||
|
||||
import java.util.List;
|
||||
|
||||
class Test {
|
||||
interface User {
|
||||
|
||||
}
|
||||
|
||||
interface Query {
|
||||
|
||||
List<?> getResultList();
|
||||
}
|
||||
|
||||
public User[] getAllUsers(Query readQuery) {
|
||||
List<?> result = readQuery.getResultList();
|
||||
return (result != null) ? result.toArray(new User[0]) : new User[0];
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// "Apply conversion '.toArray(new java.lang.String[0])'" "false"
|
||||
|
||||
import java.util.*;
|
||||
class Return {
|
||||
String[] foo() {
|
||||
List<Number> list = new ArrayList<>();
|
||||
list.add(1);
|
||||
return list<caret>;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// "Apply conversion '.toArray(new Test.User[0])'" "true"
|
||||
|
||||
import java.util.List;
|
||||
|
||||
class Test {
|
||||
interface User {
|
||||
|
||||
}
|
||||
|
||||
interface Query {
|
||||
|
||||
List<?> getResultList();
|
||||
}
|
||||
|
||||
public User[] getAllUsers(Query readQuery) {
|
||||
List<?> result = readQuery.getResultList();
|
||||
return (result != null) ? result.toAr<caret>ray() : new User[0];
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user