mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-26 19:06:24 +07:00
Java9CollectionFactoryInspection: do not check whether copied collection types agree
Fixes IDEA-195560 'List.copyOf' not suggested when Set passed to 'new ArrayList<>()'
This commit is contained in:
@@ -3,13 +3,17 @@ import java.util.*;
|
||||
|
||||
class Main {
|
||||
private final List<String> myList;
|
||||
private final List<String> myList3;
|
||||
private final Map<String, String> myMap;
|
||||
private final Set<String> mySet;
|
||||
private final Set<String> mySet2;
|
||||
|
||||
Main(Collection<String> list, Map<? extends String, ? extends String> map,
|
||||
Set<String> set) {
|
||||
myList = List.<String>copyOf(list);
|
||||
myList2 = List.<String>copyOf(set);
|
||||
myMap = Map.<String, String>copyOf(map);
|
||||
mySet = Set.<String>copyOf(set);
|
||||
mySet2 = Set.<String>copyOf(list);
|
||||
}
|
||||
}
|
||||
@@ -3,13 +3,17 @@ import java.util.*;
|
||||
|
||||
class Main {
|
||||
private final List<String> myList;
|
||||
private final List<String> myList3;
|
||||
private final Map<String, String> myMap;
|
||||
private final Set<String> mySet;
|
||||
private final Set<String> mySet2;
|
||||
|
||||
Main(Collection<String> list, Map<? extends String, ? extends String> map,
|
||||
Set<String> set) {
|
||||
myList = Collections.un<caret>modifiableList(new ArrayList<>(list));
|
||||
myList2 = Collections.unmodifiableList(new ArrayList<>(set));
|
||||
myMap = Collections.unmodifiableMap(new HashMap<>(map));
|
||||
mySet = Collections.unmodifiableSet(new HashSet<>(set));
|
||||
mySet2 = Collections.unmodifiableSet(new HashSet<>(list));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user