mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java-slice] See through unmodifiable list and friends (IDEA-194774)
GitOrigin-RevId: bd16ad8947c86e8d2b17cc230544ca66203c1d2d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
aa5d05cb34
commit
a866093918
@@ -174,12 +174,13 @@ final class SliceUtil {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (method != null && builder.hasNesting()) {
|
||||
if (method != null) {
|
||||
PsiParameter[] parameters = method.getParameterList().getParameters();
|
||||
boolean hasFlownParameter = false;
|
||||
for (int i = 0; i < parameters.length; i++) {
|
||||
Flow paramAnno = isParamFlowAnnotated(method, i);
|
||||
if (paramAnno != null && !parameters[i].isVarArgs()) {
|
||||
if (!builder.hasNesting() && !paramAnno.sourceIsContainer()) continue;
|
||||
PsiExpression[] args = call.getArgumentList().getExpressions();
|
||||
if (args.length > i) {
|
||||
JavaSliceBuilder argBuilder = builder.updateNesting(paramAnno);
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
class MainTest {
|
||||
public static void main(String[] args) {
|
||||
List<String> list = <flown111>new ArrayList<>();
|
||||
List<String> unmodifiable = <flown1>Collections.unmodifiableList(<flown11>list);
|
||||
System.out.println(<caret>unmodifiable);
|
||||
}
|
||||
}
|
||||
@@ -147,4 +147,5 @@ public class SliceBackwardTest extends SliceTestCase {
|
||||
public void testRecordComponent2() throws Exception { doTest();}
|
||||
public void testRecordComponent3() throws Exception { doTest();}
|
||||
public void testOptionalAsContainer() throws Exception { doTest();}
|
||||
public void testUnmodifiableList() throws Exception { doTest();}
|
||||
}
|
||||
|
||||
@@ -2099,6 +2099,10 @@
|
||||
</item>
|
||||
<item name="java.util.Collections java.util.Collection<E> checkedCollection(java.util.Collection<E>, java.lang.Class<E>) 0">
|
||||
<annotation name="org.jetbrains.annotations.NotNull" />
|
||||
<annotation name='org.intellij.lang.annotations.Flow'>
|
||||
<val name="sourceIsContainer" val="true"/>
|
||||
<val name="targetIsContainer" val="true"/>
|
||||
</annotation>
|
||||
</item>
|
||||
<item name="java.util.Collections java.util.Collection<E> checkedCollection(java.util.Collection<E>, java.lang.Class<E>) 1">
|
||||
<annotation name="org.jetbrains.annotations.NotNull" />
|
||||
@@ -2111,6 +2115,10 @@
|
||||
</item>
|
||||
<item name="java.util.Collections java.util.Collection<T> synchronizedCollection(java.util.Collection<T>) 0">
|
||||
<annotation name="org.jetbrains.annotations.NotNull" />
|
||||
<annotation name='org.intellij.lang.annotations.Flow'>
|
||||
<val name="sourceIsContainer" val="true"/>
|
||||
<val name="targetIsContainer" val="true"/>
|
||||
</annotation>
|
||||
</item>
|
||||
<item name="java.util.Collections java.util.Collection<T> unmodifiableCollection(java.util.Collection<? extends T>)">
|
||||
<annotation name="org.jetbrains.annotations.NotNull" />
|
||||
@@ -2118,6 +2126,10 @@
|
||||
</item>
|
||||
<item name="java.util.Collections java.util.Collection<T> unmodifiableCollection(java.util.Collection<? extends T>) 0">
|
||||
<annotation name="org.jetbrains.annotations.NotNull" />
|
||||
<annotation name='org.intellij.lang.annotations.Flow'>
|
||||
<val name="sourceIsContainer" val="true"/>
|
||||
<val name="targetIsContainer" val="true"/>
|
||||
</annotation>
|
||||
</item>
|
||||
<item name="java.util.Collections java.util.Comparator<T> reverseOrder()">
|
||||
<annotation name="org.jetbrains.annotations.NotNull" />
|
||||
@@ -2164,6 +2176,10 @@
|
||||
</item>
|
||||
<item name="java.util.Collections java.util.List<E> checkedList(java.util.List<E>, java.lang.Class<E>) 0">
|
||||
<annotation name="org.jetbrains.annotations.NotNull" />
|
||||
<annotation name='org.intellij.lang.annotations.Flow'>
|
||||
<val name="sourceIsContainer" val="true"/>
|
||||
<val name="targetIsContainer" val="true"/>
|
||||
</annotation>
|
||||
</item>
|
||||
<item name="java.util.Collections java.util.List<E> checkedList(java.util.List<E>, java.lang.Class<E>) 1">
|
||||
<annotation name="org.jetbrains.annotations.NotNull" />
|
||||
@@ -2183,6 +2199,11 @@
|
||||
<val name="pure" val="true"/>
|
||||
</annotation>
|
||||
</item>
|
||||
<item name="java.util.Collections java.util.List<T> nCopies(int, T) 1">
|
||||
<annotation name='org.intellij.lang.annotations.Flow'>
|
||||
<val name="targetIsContainer" val="true"/>
|
||||
</annotation>
|
||||
</item>
|
||||
<item name="java.util.Collections java.util.List<T> singletonList(T)">
|
||||
<annotation name="org.jetbrains.annotations.NotNull" />
|
||||
<annotation name="org.jetbrains.annotations.Unmodifiable" />
|
||||
@@ -2191,6 +2212,11 @@
|
||||
<val name="pure" val="true"/>
|
||||
</annotation>
|
||||
</item>
|
||||
<item name="java.util.Collections java.util.List<T> singletonList(T) 0">
|
||||
<annotation name='org.intellij.lang.annotations.Flow'>
|
||||
<val name="targetIsContainer" val="true"/>
|
||||
</annotation>
|
||||
</item>
|
||||
<item name='java.util.Collections java.util.List<T> synchronizedList(java.util.List<T>)'>
|
||||
<annotation name='org.jetbrains.annotations.Contract'>
|
||||
<val name="pure" val="true"/>
|
||||
@@ -2199,6 +2225,10 @@
|
||||
</item>
|
||||
<item name="java.util.Collections java.util.List<T> synchronizedList(java.util.List<T>) 0">
|
||||
<annotation name="org.jetbrains.annotations.NotNull" />
|
||||
<annotation name='org.intellij.lang.annotations.Flow'>
|
||||
<val name="sourceIsContainer" val="true"/>
|
||||
<val name="targetIsContainer" val="true"/>
|
||||
</annotation>
|
||||
</item>
|
||||
<item name="java.util.Collections java.util.List<T> unmodifiableList(java.util.List<? extends T>)">
|
||||
<annotation name="org.jetbrains.annotations.NotNull" />
|
||||
@@ -2206,6 +2236,10 @@
|
||||
</item>
|
||||
<item name="java.util.Collections java.util.List<T> unmodifiableList(java.util.List<? extends T>) 0">
|
||||
<annotation name="org.jetbrains.annotations.NotNull" />
|
||||
<annotation name='org.intellij.lang.annotations.Flow'>
|
||||
<val name="sourceIsContainer" val="true"/>
|
||||
<val name="targetIsContainer" val="true"/>
|
||||
</annotation>
|
||||
</item>
|
||||
<item name="java.util.Collections java.util.ListIterator<T> emptyListIterator()">
|
||||
<annotation name="org.jetbrains.annotations.NotNull" />
|
||||
@@ -2303,6 +2337,10 @@
|
||||
</item>
|
||||
<item name="java.util.Collections java.util.Queue<E> checkedQueue(java.util.Queue<E>, java.lang.Class<E>) 0">
|
||||
<annotation name="org.jetbrains.annotations.NotNull" />
|
||||
<annotation name='org.intellij.lang.annotations.Flow'>
|
||||
<val name="sourceIsContainer" val="true"/>
|
||||
<val name="targetIsContainer" val="true"/>
|
||||
</annotation>
|
||||
</item>
|
||||
<item name="java.util.Collections java.util.Queue<E> checkedQueue(java.util.Queue<E>, java.lang.Class<E>) 1">
|
||||
<annotation name="org.jetbrains.annotations.NotNull" />
|
||||
@@ -2315,6 +2353,10 @@
|
||||
</item>
|
||||
<item name="java.util.Collections java.util.Queue<T> asLifoQueue(java.util.Deque<T>) 0">
|
||||
<annotation name="org.jetbrains.annotations.NotNull" />
|
||||
<annotation name='org.intellij.lang.annotations.Flow'>
|
||||
<val name="sourceIsContainer" val="true"/>
|
||||
<val name="targetIsContainer" val="true"/>
|
||||
</annotation>
|
||||
</item>
|
||||
<item name='java.util.Collections java.util.Set<E> checkedSet(java.util.Set<E>, java.lang.Class<E>)'>
|
||||
<annotation name='org.jetbrains.annotations.Contract'>
|
||||
@@ -2324,6 +2366,10 @@
|
||||
</item>
|
||||
<item name="java.util.Collections java.util.Set<E> checkedSet(java.util.Set<E>, java.lang.Class<E>) 0">
|
||||
<annotation name="org.jetbrains.annotations.NotNull" />
|
||||
<annotation name='org.intellij.lang.annotations.Flow'>
|
||||
<val name="sourceIsContainer" val="true"/>
|
||||
<val name="targetIsContainer" val="true"/>
|
||||
</annotation>
|
||||
</item>
|
||||
<item name="java.util.Collections java.util.Set<E> checkedSet(java.util.Set<E>, java.lang.Class<E>) 1">
|
||||
<annotation name="org.jetbrains.annotations.NotNull" />
|
||||
@@ -2352,6 +2398,11 @@
|
||||
<val name="pure" val="true"/>
|
||||
</annotation>
|
||||
</item>
|
||||
<item name="java.util.Collections java.util.Set<T> singleton(T) 0">
|
||||
<annotation name='org.intellij.lang.annotations.Flow'>
|
||||
<val name="targetIsContainer" val="true"/>
|
||||
</annotation>
|
||||
</item>
|
||||
<item name='java.util.Collections java.util.Set<T> synchronizedSet(java.util.Set<T>)'>
|
||||
<annotation name='org.jetbrains.annotations.Contract'>
|
||||
<val name="pure" val="true"/>
|
||||
@@ -2360,6 +2411,10 @@
|
||||
</item>
|
||||
<item name="java.util.Collections java.util.Set<T> synchronizedSet(java.util.Set<T>) 0">
|
||||
<annotation name="org.jetbrains.annotations.NotNull" />
|
||||
<annotation name='org.intellij.lang.annotations.Flow'>
|
||||
<val name="sourceIsContainer" val="true"/>
|
||||
<val name="targetIsContainer" val="true"/>
|
||||
</annotation>
|
||||
</item>
|
||||
<item name="java.util.Collections java.util.Set<T> unmodifiableSet(java.util.Set<? extends T>)">
|
||||
<annotation name="org.jetbrains.annotations.NotNull" />
|
||||
@@ -2367,6 +2422,10 @@
|
||||
</item>
|
||||
<item name="java.util.Collections java.util.Set<T> unmodifiableSet(java.util.Set<? extends T>) 0">
|
||||
<annotation name="org.jetbrains.annotations.NotNull" />
|
||||
<annotation name='org.intellij.lang.annotations.Flow'>
|
||||
<val name="sourceIsContainer" val="true"/>
|
||||
<val name="targetIsContainer" val="true"/>
|
||||
</annotation>
|
||||
</item>
|
||||
<item name='java.util.Collections java.util.SortedMap<K,V> checkedSortedMap(java.util.SortedMap<K,V>, java.lang.Class<K>, java.lang.Class<V>)'>
|
||||
<annotation name='org.jetbrains.annotations.Contract'>
|
||||
@@ -2413,6 +2472,10 @@
|
||||
</item>
|
||||
<item name="java.util.Collections java.util.SortedSet<E> checkedSortedSet(java.util.SortedSet<E>, java.lang.Class<E>) 0">
|
||||
<annotation name="org.jetbrains.annotations.NotNull" />
|
||||
<annotation name='org.intellij.lang.annotations.Flow'>
|
||||
<val name="sourceIsContainer" val="true"/>
|
||||
<val name="targetIsContainer" val="true"/>
|
||||
</annotation>
|
||||
</item>
|
||||
<item name="java.util.Collections java.util.SortedSet<E> checkedSortedSet(java.util.SortedSet<E>, java.lang.Class<E>) 1">
|
||||
<annotation name="org.jetbrains.annotations.NotNull" />
|
||||
@@ -2432,6 +2495,10 @@
|
||||
</item>
|
||||
<item name="java.util.Collections java.util.SortedSet<T> synchronizedSortedSet(java.util.SortedSet<T>) 0">
|
||||
<annotation name="org.jetbrains.annotations.NotNull" />
|
||||
<annotation name='org.intellij.lang.annotations.Flow'>
|
||||
<val name="sourceIsContainer" val="true"/>
|
||||
<val name="targetIsContainer" val="true"/>
|
||||
</annotation>
|
||||
</item>
|
||||
<item name="java.util.Collections java.util.SortedSet<T> unmodifiableSortedSet(java.util.SortedSet<T>)">
|
||||
<annotation name="org.jetbrains.annotations.NotNull" />
|
||||
@@ -2439,6 +2506,10 @@
|
||||
</item>
|
||||
<item name="java.util.Collections java.util.SortedSet<T> unmodifiableSortedSet(java.util.SortedSet<T>) 0">
|
||||
<annotation name="org.jetbrains.annotations.NotNull" />
|
||||
<annotation name='org.intellij.lang.annotations.Flow'>
|
||||
<val name="sourceIsContainer" val="true"/>
|
||||
<val name="targetIsContainer" val="true"/>
|
||||
</annotation>
|
||||
</item>
|
||||
<item name='java.util.Collections void copy(java.util.List<? super T>, java.util.List<? extends T>)'>
|
||||
<annotation name='org.jetbrains.annotations.Contract'>
|
||||
|
||||
Reference in New Issue
Block a user