mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-05 01:50:56 +07:00
deprecate EmptyIterable in favor of standard Collections.emptyList()
GitOrigin-RevId: e0e211241eb48f665a3117627c81f0c67fff0883
This commit is contained in:
committed by
intellij-monorepo-bot
parent
994a5554c0
commit
332ca6d5cf
@@ -28,7 +28,6 @@ import com.intellij.psi.tree.TokenSet;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.TimeoutUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.EmptyIterable;
|
||||
import com.intellij.util.containers.JBIterable;
|
||||
import org.intellij.lang.annotations.MagicConstant;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
@@ -988,7 +987,7 @@ public final class PsiUtil extends PsiUtilCore {
|
||||
currentOwner = currentOwner.getContainingClass();
|
||||
}
|
||||
|
||||
if (result == null) return EmptyIterable.getInstance();
|
||||
if (result == null) return Collections.emptyList();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.intellij.lang.Language;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -60,13 +61,13 @@ public class MethodInfoBlacklistFilter implements HintInfoFilter {
|
||||
private static Set<String> fullBlacklist(Language language) {
|
||||
InlayParameterHintsProvider provider = InlayParameterHintsExtension.INSTANCE.forLanguage(language);
|
||||
if (provider == null) {
|
||||
return ContainerUtil.newHashOrEmptySet(ContainerUtil.emptyIterable());
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
Set<String> blackList = blacklist(language);
|
||||
Language dependentLanguage = provider.getBlackListDependencyLanguage();
|
||||
if (dependentLanguage != null) {
|
||||
blackList.addAll(blacklist(dependentLanguage));
|
||||
blackList = ContainerUtil.union(blackList, blacklist(dependentLanguage));
|
||||
}
|
||||
return blackList;
|
||||
}
|
||||
@@ -79,7 +80,7 @@ public class MethodInfoBlacklistFilter implements HintInfoFilter {
|
||||
Diff diff = settings.getBlackListDiff(getLanguageForSettingKey(language));
|
||||
return diff.applyOn(provider.getDefaultBlackList());
|
||||
}
|
||||
return ContainerUtil.newHashOrEmptySet(ContainerUtil.emptyIterable());
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -37,7 +37,6 @@ import com.intellij.openapi.vfs.newvfs.NewVirtualFile;
|
||||
import com.intellij.openapi.vfs.newvfs.NewVirtualFileSystem;
|
||||
import com.intellij.util.LineSeparator;
|
||||
import com.intellij.util.ObjectUtils;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.io.UnsyncByteArrayInputStream;
|
||||
import com.intellij.util.keyFMap.KeyFMap;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -71,7 +70,7 @@ public class VirtualFileImpl extends VirtualFileSystemEntry {
|
||||
@NotNull
|
||||
@Override
|
||||
public Iterable<VirtualFile> iterInDbChildren() {
|
||||
return ContainerUtil.emptyIterable();
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -32,7 +32,6 @@ import com.intellij.ui.DirtyUI;
|
||||
import com.intellij.ui.Gray;
|
||||
import com.intellij.ui.components.breadcrumbs.Crumb;
|
||||
import com.intellij.util.concurrency.NonUrgentExecutor;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.ui.MouseEventAdapter;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.util.ui.update.MergingUpdateQueue;
|
||||
@@ -50,6 +49,7 @@ import java.awt.event.MouseEvent;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static com.intellij.openapi.diagnostic.Logger.getInstance;
|
||||
@@ -83,7 +83,7 @@ public abstract class BreadcrumbsPanel extends JComponent implements Disposable
|
||||
};
|
||||
|
||||
private static final Key<BreadcrumbsPanel> BREADCRUMBS_COMPONENT_KEY = new Key<>("BREADCRUMBS_KEY");
|
||||
private static final Iterable<? extends Crumb> EMPTY_BREADCRUMBS = ContainerUtil.emptyIterable();
|
||||
private static final Iterable<? extends Crumb> EMPTY_BREADCRUMBS = Collections.emptyList();
|
||||
|
||||
public BreadcrumbsPanel(@NotNull final Editor editor) {
|
||||
myEditor = editor;
|
||||
|
||||
@@ -22,10 +22,7 @@ import com.intellij.util.text.CharArrayUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
import java.util.PriorityQueue;
|
||||
import java.util.*;
|
||||
|
||||
import static com.intellij.xml.breadcrumbs.BreadcrumbsUtilEx.findProvider;
|
||||
|
||||
@@ -99,7 +96,7 @@ public class PsiFileBreadcrumbsCollector extends FileBreadcrumbsCollector {
|
||||
Collection<Pair<PsiElement, BreadcrumbsProvider>> pairs =
|
||||
getLineElements(document, offset, file, myProject, defaultInfoProvider, true);
|
||||
|
||||
if (pairs == null) return ContainerUtil.emptyIterable();
|
||||
if (pairs == null) return Collections.emptyList();
|
||||
|
||||
ArrayList<Crumb> result = new ArrayList<>(pairs.size());
|
||||
CrumbPresentation[] presentations = getCrumbPresentations(toPsiElementArray(pairs));
|
||||
|
||||
@@ -337,8 +337,8 @@ public class ContainerUtil extends ContainerUtilRt {
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link SmartList(T)}
|
||||
*/
|
||||
* @deprecated Use {@link SmartList(T)}
|
||||
*/
|
||||
@SafeVarargs
|
||||
@NotNull
|
||||
@Contract(pure=true)
|
||||
@@ -944,10 +944,14 @@ public class ContainerUtil extends ContainerUtilRt {
|
||||
return Collections.emptyIterator();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link Collections#emptyList()} instead
|
||||
*/
|
||||
@NotNull
|
||||
@Deprecated
|
||||
@Contract(pure=true)
|
||||
public static <T> Iterable<T> emptyIterable() {
|
||||
return EmptyIterable.getInstance();
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Contract(pure=true)
|
||||
@@ -1301,7 +1305,7 @@ public class ContainerUtil extends ContainerUtilRt {
|
||||
@NotNull
|
||||
@Contract(pure=true)
|
||||
public static <T> Iterable<T> iterate(@NotNull final Collection<? extends T> collection, @NotNull final Condition<? super T> condition) {
|
||||
if (collection.isEmpty()) return emptyIterable();
|
||||
if (collection.isEmpty()) return Collections.emptyList();
|
||||
return () -> new Iterator<T>() {
|
||||
private final Iterator<? extends T> impl = collection.iterator();
|
||||
private T next = findNext();
|
||||
@@ -1605,7 +1609,7 @@ public class ContainerUtil extends ContainerUtilRt {
|
||||
@NotNull
|
||||
@Contract(pure=true)
|
||||
public static <T> Iterable<T> concat(final Iterable<? extends T> @NotNull ... iterables) {
|
||||
if (iterables.length == 0) return emptyIterable();
|
||||
if (iterables.length == 0) return Collections.emptyList();
|
||||
if (iterables.length == 1) {
|
||||
//noinspection unchecked
|
||||
return (Iterable<T>)iterables[0];
|
||||
@@ -2345,25 +2349,6 @@ public class ContainerUtil extends ContainerUtilRt {
|
||||
return count;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Contract(pure=true)
|
||||
public static <T> List<T> unfold(@Nullable T t, @NotNull NullableFunction<? super T, ? extends T> next) {
|
||||
if (t == null) return emptyList();
|
||||
|
||||
List<T> list = new ArrayList<>();
|
||||
while (t != null) {
|
||||
list.add(t);
|
||||
t = next.fun(t);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Contract(pure=true)
|
||||
public static <T> List<T> dropTail(@NotNull List<T> items) {
|
||||
return items.subList(0, items.size() - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link Arrays#asList(Object[])}
|
||||
*/
|
||||
|
||||
@@ -20,6 +20,10 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link Collections#emptyList()} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public class EmptyIterable<T> implements Iterable<T> {
|
||||
private static final EmptyIterable INSTANCE = new EmptyIterable();
|
||||
|
||||
|
||||
@@ -265,7 +265,7 @@ public class MavenGroovyPolyglotPomMemberContributor extends NonCodeMembersContr
|
||||
|
||||
if (!methodCallInfo.isEmpty() &&
|
||||
StringUtil.endsWithIgnoreCase(ContainerUtil.getLastItem(methodCallInfo), CompletionUtilCore.DUMMY_IDENTIFIER_TRIMMED)) {
|
||||
key = StringUtil.join(ContainerUtil.dropTail(methodCallInfo), "->");
|
||||
key = StringUtil.join(methodCallInfo.subList(0, methodCallInfo.size() - 1), "->");
|
||||
for (String classSource : multiMap.get(key)) {
|
||||
DynamicMemberUtils.process(processor, false, place, classSource);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user