IJPL-176959 explicitly use deprecated Query.asIterable to raise awareness

GitOrigin-RevId: 5a2122d583775c3a30670058b6b292fa99b639dc
This commit is contained in:
Daniil Ovchinnikov
2025-02-06 16:14:45 +00:00
committed by intellij-monorepo-bot
parent e1569442ee
commit feb324866d
12 changed files with 30 additions and 29 deletions
@@ -1,4 +1,4 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.debugger.settings;
import com.intellij.codeInsight.AnnotationUtil;
@@ -619,6 +619,7 @@ public class NodeRendererSettings implements PersistentStateComponent<Element> {
PsiClass annotationClass = JavaPsiFacade.getInstance(project).findClass(annotationFqn, GlobalSearchScope.allScope(project));
if (annotationClass == null) continue;
AnnotatedElementsSearch.searchElements(annotationClass, GlobalSearchScope.allScope(project), types)
.asIterable()
.forEach((PsiModifierListOwner owner) -> {
R element = consumer.apply(owner, AnnotationUtil.findAnnotation(owner, annotationFqn));
if (element != null) {
@@ -1,4 +1,4 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.codeInspection;
import com.intellij.codeInsight.intention.impl.RemoveRedundantParameterTypesFix;
@@ -409,6 +409,7 @@ public final class ComparatorCombinatorsInspection extends AbstractBaseJavaLocal
@NotNull PsiVariable exprVariable) {
PsiExpression copy = (PsiExpression)expression.copy();
ReferencesSearch.search(exprVariable, new LocalSearchScope(copy))
.asIterable()
.forEach(reference ->{
PsiReferenceExpression ref = tryCast(reference.getElement(), PsiReferenceExpression.class);
if(ref == null) return;
@@ -1,4 +1,4 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.codeInspection.streamMigration;
@@ -1192,7 +1192,7 @@ public class JoiningMigration extends BaseStreamApiMigration {
@NotNull PsiExpression replacement) {
List<PsiExpression> copies = ContainerUtil.map(joinParts, expression -> (PsiExpression)expression.copy());
for (PsiElement joinPart : copies) {
ReferencesSearch.search(localVariable, new LocalSearchScope(joinPart)).forEach(reference -> {
ReferencesSearch.search(localVariable, new LocalSearchScope(joinPart)).asIterable().forEach(reference -> {
reference.getElement().replace(replacement);
});
}
@@ -1,4 +1,4 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.refactoring.introduceVariable;
import com.intellij.codeInsight.intention.impl.TypeExpression;
@@ -398,7 +398,7 @@ public class JavaVariableInplaceIntroducer extends AbstractJavaInplaceIntroducer
if (isReplaceAllOccurrences()) {
List<RangeMarker> occurrences = new ArrayList<>();
ReferencesSearch.search(variable).forEach(reference -> {
ReferencesSearch.search(variable).asIterable().forEach(reference -> {
occurrences.add(createMarker(reference.getElement()));
});
setOccurrenceMarkers(occurrences);
@@ -983,7 +983,7 @@ public class JavaSafeDeleteProcessor extends SafeDeleteProcessorDelegateBase {
assert header != null;
int index = ArrayUtil.indexOf(header.getRecordComponents(), component);
if (index < 0) return isInsideDeleted;
ReferencesSearch.search(constructor).forEach(ref -> {
ReferencesSearch.search(constructor).asIterable().forEach(ref -> {
PsiElement element = ref.getElement();
if (!isInsideDeleted.test(element)) {
JavaSafeDeleteDelegate safeDeleteDelegate = JavaSafeDeleteDelegate.EP.forLanguage(element.getLanguage());
@@ -993,7 +993,7 @@ public class JavaSafeDeleteProcessor extends SafeDeleteProcessorDelegateBase {
}
});
}
ReferencesSearch.search(component).forEach(ref -> {
ReferencesSearch.search(component).asIterable().forEach(ref -> {
PsiElement element = ref.getElement();
if (!isInsideDeleted.test(element)) {
boolean javadoc = element instanceof PsiDocParamRef;
@@ -1,4 +1,4 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.codeInsight.daemon.impl;
import com.intellij.concurrency.JobLauncher;
@@ -121,6 +121,7 @@ final class JavaTelescope {
AtomicInteger count = new AtomicInteger();
ClassInheritorsSearch.INSTANCE.createQuery(new ClassInheritorsSearch.SearchParameters(aClass, aClass.getUseScope(), true, true, true))
.asIterable()
.forEach((Consumer<? super PsiClass>)__ -> count.incrementAndGet());
return count.get();
@@ -128,7 +129,7 @@ final class JavaTelescope {
static int collectOverridingMethods(@NotNull PsiMethod method) {
AtomicInteger count = new AtomicInteger();
OverridingMethodsSearch.search(method).forEach((Consumer<? super PsiMethod>)__ -> count.incrementAndGet());
OverridingMethodsSearch.search(method).asIterable().forEach((Consumer<? super PsiMethod>)__ -> count.incrementAndGet());
return count.get();
}
@@ -1,4 +1,4 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.codeInsight.daemon.impl.quickfix;
import com.intellij.codeInsight.FileModificationService;
@@ -378,7 +378,7 @@ public class MethodReturnTypeFix extends LocalQuickFixAndIntentionActionOnPsiEle
PsiMethod[] hierarchyMethods = methods;
if (!ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> {
for (PsiMethod psiMethod : hierarchyMethods) {
OverridingMethodsSearch.search(psiMethod).forEach(m -> {
OverridingMethodsSearch.search(psiMethod).asIterable().forEach(m -> {
affectedMethods.add(m);
});
}
@@ -90,7 +90,7 @@ public class JavaFindUsagesHandler extends FindUsagesHandler {
}
}
FunctionalExpressionSearch.search(method).forEach(element -> {
FunctionalExpressionSearch.search(method).asIterable().forEach(element -> {
if (element instanceof PsiLambdaExpression) {
PsiParameter[] parameters = ReadAction.compute(() -> ((PsiLambdaExpression)element).getParameterList().getParameters());
if (idx < parameters.length) {
@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.psi.impl.search;
import com.intellij.ide.todo.TodoConfiguration;
@@ -6,7 +6,10 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiFile;
import com.intellij.psi.impl.cache.TodoCacheManager;
import com.intellij.psi.search.*;
import com.intellij.psi.search.IndexPatternProvider;
import com.intellij.psi.search.PsiTodoSearchHelper;
import com.intellij.psi.search.TodoItem;
import com.intellij.psi.search.TodoPattern;
import com.intellij.psi.search.searches.IndexPatternSearch;
import com.intellij.psi.util.PsiUtilCore;
import com.intellij.util.CommonProcessors;
@@ -48,7 +51,7 @@ public class PsiTodoSearchHelperImpl implements PsiTodoSearchHelper {
TodoItemCreator todoItemCreator = new TodoItemCreator();
boolean multiLine = TodoConfiguration.getInstance().isMultiLine();
for (IndexPatternProvider provider : IndexPatternProvider.EP_NAME.getExtensionList()) {
IndexPatternSearch.search(file, provider, startOffset, endOffset, multiLine).forEach(occurrence -> {
IndexPatternSearch.search(file, provider, startOffset, endOffset, multiLine).asIterable().forEach(occurrence -> {
if (occurrence.getTextRange().intersects(startOffset, endOffset)) {
occurrences.add(todoItemCreator.createTodo(occurrence));
}
@@ -69,7 +72,7 @@ public class PsiTodoSearchHelperImpl implements PsiTodoSearchHelper {
for (IndexPatternProvider provider : IndexPatternProvider.EP_NAME.getExtensionList()) {
LightIndexPatternSearch.SEARCH.createQuery(
new IndexPatternSearch.SearchParameters(file, provider, TodoConfiguration.getInstance().isMultiLine())
).forEach(occurrence -> {
).asIterable().forEach(occurrence -> {
if (occurrence.getTextRange().intersects(startOffset, endOffset)) {
occurrences.add(todoItemCreator.createTodo(occurrence));
}
@@ -1,4 +1,4 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.idea.devkit.references;
import com.intellij.codeInsight.daemon.EmptyResolveMessageProvider;
@@ -209,7 +209,7 @@ final class IconsReferencesQueryExecutor implements QueryExecutor<PsiReference,
final Query<PsiClass> allIconsSearch =
AllClassesSearch.search(productionScope.intersectWith(GlobalSearchScope.notScope(notIconsPackageScope)),
project, s -> StringUtil.endsWith(s, ICONS_CLASSNAME_SUFFIX) && !s.equals(ICONS_CLASSNAME_SUFFIX));
allIconsSearch.forEach(psiClass -> {
allIconsSearch.asIterable().forEach(psiClass -> {
if (ALL_ICONS_FQN.equals(psiClass.getQualifiedName()) ||
psiClass.isInterface() ||
psiClass.getContainingClass() != null ||
@@ -1,4 +1,4 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.plugins.javaFX.sceneBuilder;// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
import com.intellij.openapi.application.ReadAction;
@@ -159,7 +159,7 @@ public class SceneBuilderImpl implements SceneBuilder {
final LanguageLevel ideLanguageLevel = ideJdkVersion != null ? ideJdkVersion.getMaxLanguageLevel() : null;
final Query<PsiClass> query = ClassInheritorsSearch.search(nodeClass, scope, true, true, false);
final Set<PsiClass> result = new HashSet<>();
query.forEach(psiClass -> {
query.asIterable().forEach(psiClass -> {
if (psiClass.hasModifierProperty(PsiModifier.PUBLIC) &&
!psiClass.hasModifierProperty(PsiModifier.ABSTRACT) &&
!isBuiltInComponent(psiClass) &&
@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.kotlin.idea.refactoring.changeSignature
@@ -15,12 +15,7 @@ import com.intellij.util.VisibilityUtil
import org.jetbrains.kotlin.asJava.getRepresentativeLightMethod
import org.jetbrains.kotlin.asJava.toLightMethods
import org.jetbrains.kotlin.asJava.unwrapped
import org.jetbrains.kotlin.descriptors.CallableDescriptor
import org.jetbrains.kotlin.descriptors.DescriptorVisibilities
import org.jetbrains.kotlin.descriptors.DescriptorVisibility
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
import org.jetbrains.kotlin.descriptors.Visibilities
import org.jetbrains.kotlin.descriptors.Visibility
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.idea.KotlinLanguage
import org.jetbrains.kotlin.idea.base.facet.platform.platform
import org.jetbrains.kotlin.idea.base.psi.unquoteKotlinIdentifier
@@ -260,7 +255,7 @@ open class KotlinChangeInfo(
for (caller in value) {
add(caller)
OverridingMethodsSearch.search(caller.getRepresentativeLightMethod() ?: continue).forEach(::add)
OverridingMethodsSearch.search(caller.getRepresentativeLightMethod() ?: continue).asIterable().forEach(::add)
}
propagationTargetUsageInfos = result.toList()