mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 21:55:01 +07:00
Java: Intention that wraps list/set/map with Collections.unmodifiable - check the required type (IDEA-93154)
This commit is contained in:
+12
@@ -0,0 +1,12 @@
|
||||
// "Wrap with unmodifiable map" "true"
|
||||
import java.util.Collections;
|
||||
import java.util.NavigableMap;
|
||||
import java.util.SortedMap;
|
||||
import java.util.TreeMap;
|
||||
|
||||
class C {
|
||||
SortedMap<String, Integer> test() {
|
||||
NavigableMap<String, Integer> result = new TreeMap<>();
|
||||
return Collections.unmodifiableSortedMap(result);
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Wrap with unmodifiable set" "false"
|
||||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
|
||||
class C {
|
||||
void test() {
|
||||
HashSet<String> result = new HashSet<>();
|
||||
HashSet<String> other;
|
||||
other = <caret>result;
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Wrap with unmodifiable map" "false"
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
|
||||
class C {
|
||||
void test() {
|
||||
var result = new HashMap<>();
|
||||
foo(<caret>result);
|
||||
}
|
||||
|
||||
void foo(HashMap<String, Integer> map) {}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Wrap with unmodifiable set" "false"
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
class C {
|
||||
void test() {
|
||||
TreeSet<String> result = new TreeSet<>();
|
||||
TreeSet<String> other = <caret>result;
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Wrap with unmodifiable map" "false"
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
|
||||
class C {
|
||||
void test() {
|
||||
var result = new HashMap<>();
|
||||
foo(<caret>result);
|
||||
}
|
||||
|
||||
void foo(Map<String, Integer> map) {}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Wrap with unmodifiable map" "true"
|
||||
import java.util.NavigableMap;
|
||||
import java.util.SortedMap;
|
||||
import java.util.TreeMap;
|
||||
|
||||
class C {
|
||||
SortedMap<String, Integer> test() {
|
||||
NavigableMap<String, Integer> result = new TreeMap<>();
|
||||
return <caret>result;
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Wrap with unmodifiable list" "false"
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
class C {
|
||||
ArrayList<String> test() {
|
||||
List<String> result = new ArrayList<>();
|
||||
return <caret>result;
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Wrap with unmodifiable map" "false"
|
||||
import java.util.NavigableMap;
|
||||
import java.util.SortedMap;
|
||||
import java.util.TreeMap;
|
||||
|
||||
class C {
|
||||
NavigableMap<String, Integer> test() {
|
||||
NavigableMap<String, Integer> result = new TreeMap<>();
|
||||
return <caret>result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user