mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
make Query accept wildcard processor: update executor implementations
This commit is contained in:
+1
-1
@@ -100,7 +100,7 @@ public class MethodReferencesSearch extends ExtensibleQueryFactory<PsiReference,
|
||||
}
|
||||
|
||||
public static void searchOptimized(final PsiMethod method, SearchScope scope, final boolean strictSignatureSearch,
|
||||
@NotNull SearchRequestCollector collector, final Processor<PsiReference> processor) {
|
||||
@NotNull SearchRequestCollector collector, final Processor<? super PsiReference> processor) {
|
||||
searchOptimized(method, scope, strictSignatureSearch, collector, false, (psiReference, collector1) -> processor.process(psiReference));
|
||||
}
|
||||
|
||||
|
||||
+3
-17
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package com.intellij.codeInsight.navigation;
|
||||
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
@@ -30,12 +16,12 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ClassImplementationsSearch implements QueryExecutor<PsiElement, DefinitionsScopedSearch.SearchParameters> {
|
||||
@Override
|
||||
public boolean execute(@NotNull DefinitionsScopedSearch.SearchParameters queryParameters, @NotNull Processor<PsiElement> consumer) {
|
||||
public boolean execute(@NotNull DefinitionsScopedSearch.SearchParameters queryParameters, @NotNull Processor<? super PsiElement> consumer) {
|
||||
final PsiElement sourceElement = queryParameters.getElement();
|
||||
return !(sourceElement instanceof PsiClass) || processImplementations((PsiClass)sourceElement, consumer, queryParameters.getScope());
|
||||
}
|
||||
|
||||
public static boolean processImplementations(final PsiClass psiClass, final Processor<PsiElement> processor, SearchScope scope) {
|
||||
public static boolean processImplementations(final PsiClass psiClass, final Processor<? super PsiElement> processor, SearchScope scope) {
|
||||
final boolean showInterfaces = Registry.is("ide.goto.implementation.show.interfaces");
|
||||
if (!ClassInheritorsSearch.search(psiClass, scope, true).forEach(new PsiElementProcessorAdapter<>(element -> {
|
||||
if (!showInterfaces && element.isInterface()) {
|
||||
|
||||
+6
-21
@@ -1,22 +1,7 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package com.intellij.codeInsight.navigation;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFunctionalExpression;
|
||||
import com.intellij.psi.PsiMethod;
|
||||
import com.intellij.psi.search.SearchScope;
|
||||
import com.intellij.psi.search.searches.DefinitionsScopedSearch;
|
||||
@@ -32,7 +17,7 @@ import java.util.List;
|
||||
|
||||
public class MethodImplementationsSearch implements QueryExecutor<PsiElement, DefinitionsScopedSearch.SearchParameters> {
|
||||
@Override
|
||||
public boolean execute(@NotNull final DefinitionsScopedSearch.SearchParameters queryParameters, @NotNull final Processor<PsiElement> consumer) {
|
||||
public boolean execute(@NotNull final DefinitionsScopedSearch.SearchParameters queryParameters, @NotNull final Processor<? super PsiElement> consumer) {
|
||||
final PsiElement sourceElement = queryParameters.getElement();
|
||||
if (sourceElement instanceof PsiMethod) {
|
||||
return processImplementations((PsiMethod)sourceElement, consumer, queryParameters.getScope());
|
||||
@@ -40,17 +25,17 @@ public class MethodImplementationsSearch implements QueryExecutor<PsiElement, De
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean processImplementations(final PsiMethod psiMethod, final Processor<PsiElement> consumer,
|
||||
public static boolean processImplementations(final PsiMethod psiMethod, final Processor<? super PsiElement> consumer,
|
||||
final SearchScope searchScope) {
|
||||
return processOverridingMethods(psiMethod, searchScope, consumer::process) &&
|
||||
FunctionalExpressionSearch.search(psiMethod, searchScope).forEach((Processor<PsiFunctionalExpression>)consumer::process);
|
||||
return processOverridingMethods(psiMethod, searchScope, consumer) &&
|
||||
FunctionalExpressionSearch.search(psiMethod, searchScope).forEach(consumer);
|
||||
}
|
||||
|
||||
public static void getOverridingMethods(PsiMethod method, List<PsiMethod> list, SearchScope scope) {
|
||||
processOverridingMethods(method, scope, new CommonProcessors.CollectProcessor<>(list));
|
||||
}
|
||||
|
||||
private static boolean processOverridingMethods(PsiMethod method, SearchScope scope, Processor<PsiMethod> processor) {
|
||||
private static boolean processOverridingMethods(PsiMethod method, SearchScope scope, Processor<? super PsiMethod> processor) {
|
||||
return OverridingMethodsSearch.search(method, scope, true).forEach(processor);
|
||||
}
|
||||
|
||||
|
||||
+5
-19
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
|
||||
/*
|
||||
* @author max
|
||||
@@ -42,7 +28,7 @@ import java.util.*;
|
||||
|
||||
public class AllClassesSearchExecutor implements QueryExecutor<PsiClass, AllClassesSearch.SearchParameters> {
|
||||
@Override
|
||||
public boolean execute(@NotNull final AllClassesSearch.SearchParameters queryParameters, @NotNull final Processor<PsiClass> consumer) {
|
||||
public boolean execute(@NotNull final AllClassesSearch.SearchParameters queryParameters, @NotNull final Processor<? super PsiClass> consumer) {
|
||||
SearchScope scope = queryParameters.getScope();
|
||||
|
||||
if (scope instanceof GlobalSearchScope) {
|
||||
@@ -58,7 +44,7 @@ public class AllClassesSearchExecutor implements QueryExecutor<PsiClass, AllClas
|
||||
|
||||
private static boolean processAllClassesInGlobalScope(@NotNull final GlobalSearchScope scope,
|
||||
@NotNull final AllClassesSearch.SearchParameters parameters,
|
||||
@NotNull Processor<PsiClass> processor) {
|
||||
@NotNull Processor<? super PsiClass> processor) {
|
||||
final Set<String> names = new THashSet<>(10000);
|
||||
processClassNames(parameters.getProject(), scope, s -> {
|
||||
if (parameters.nameMatches(s)) {
|
||||
@@ -75,7 +61,7 @@ public class AllClassesSearchExecutor implements QueryExecutor<PsiClass, AllClas
|
||||
public static boolean processClassesByNames(Project project,
|
||||
final GlobalSearchScope scope,
|
||||
Collection<String> names,
|
||||
Processor<PsiClass> processor) {
|
||||
Processor<? super PsiClass> processor) {
|
||||
final PsiShortNamesCache cache = PsiShortNamesCache.getInstance(project);
|
||||
for (final String name : names) {
|
||||
ProgressIndicatorProvider.checkCanceled();
|
||||
@@ -103,7 +89,7 @@ public class AllClassesSearchExecutor implements QueryExecutor<PsiClass, AllClas
|
||||
return project;
|
||||
}
|
||||
|
||||
private static boolean processScopeRootForAllClasses(@NotNull final PsiElement scopeRoot, @NotNull final Processor<PsiClass> processor) {
|
||||
private static boolean processScopeRootForAllClasses(@NotNull final PsiElement scopeRoot, @NotNull final Processor<? super PsiClass> processor) {
|
||||
final boolean[] stopped = {false};
|
||||
|
||||
final JavaElementVisitor visitor = scopeRoot instanceof PsiCompiledElement ? new JavaRecursiveElementVisitor() {
|
||||
|
||||
+2
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package com.intellij.psi.impl.search;
|
||||
|
||||
import com.intellij.openapi.application.ReadAction;
|
||||
@@ -37,7 +23,7 @@ import java.util.List;
|
||||
*/
|
||||
public class AnnotatedElementsSearcher implements QueryExecutor<PsiModifierListOwner, AnnotatedElementsSearch.Parameters> {
|
||||
@Override
|
||||
public boolean execute(@NotNull final AnnotatedElementsSearch.Parameters p, @NotNull final Processor<PsiModifierListOwner> consumer) {
|
||||
public boolean execute(@NotNull final AnnotatedElementsSearch.Parameters p, @NotNull final Processor<? super PsiModifierListOwner> consumer) {
|
||||
final PsiClass annClass = p.getAnnotationClass();
|
||||
if (!annClass.isAnnotationType()) throw new IllegalArgumentException("Annotation type should be passed to annotated members search but got: "+annClass);
|
||||
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ public class AnnotatedPackagesSearcher implements QueryExecutor<PsiPackage, Anno
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.search.AnnotatedPackagesSearcher");
|
||||
|
||||
@Override
|
||||
public boolean execute(@NotNull final AnnotatedPackagesSearch.Parameters p, @NotNull final Processor<PsiPackage> consumer) {
|
||||
public boolean execute(@NotNull final AnnotatedPackagesSearch.Parameters p, @NotNull final Processor<? super PsiPackage> consumer) {
|
||||
final PsiClass annClass = p.getAnnotationClass();
|
||||
assert annClass.isAnnotationType() : "Annotation type should be passed to annotated packages search";
|
||||
|
||||
|
||||
+2
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package com.intellij.psi.impl.search;
|
||||
|
||||
import com.intellij.openapi.application.QueryExecutorBase;
|
||||
@@ -37,7 +23,7 @@ import java.util.Set;
|
||||
public class ClassesWithAnnotatedMembersSearcher extends QueryExecutorBase<PsiClass,ClassesWithAnnotatedMembersSearch.Parameters> {
|
||||
@Override
|
||||
public void processQuery(@NotNull ClassesWithAnnotatedMembersSearch.Parameters queryParameters,
|
||||
@NotNull final Processor<PsiClass> consumer) {
|
||||
@NotNull final Processor<? super PsiClass> consumer) {
|
||||
SearchScope scope = queryParameters.getScope();
|
||||
for (QueryExecutor executor : Extensions.getExtensions(ClassesWithAnnotatedMembersSearch.EP_NAME)) {
|
||||
if (executor instanceof ScopedQueryExecutor) {
|
||||
|
||||
+6
-20
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package com.intellij.psi.impl.search;
|
||||
|
||||
import com.intellij.ide.highlighter.JavaFileType;
|
||||
@@ -51,7 +37,7 @@ class ConstructorReferencesSearchHelper {
|
||||
* 2. Exception avoidance. Project is needed outside of read action (to run it via DumbService in the first place),
|
||||
* and so getProject would fail with an assertion that read action is required but not present.
|
||||
*/
|
||||
boolean processConstructorReferences(@NotNull final Processor<PsiReference> processor,
|
||||
boolean processConstructorReferences(@NotNull final Processor<? super PsiReference> processor,
|
||||
@NotNull final PsiMethod constructor,
|
||||
@NotNull final PsiClass containingClass,
|
||||
@NotNull final SearchScope searchScope,
|
||||
@@ -132,7 +118,7 @@ class ConstructorReferencesSearchHelper {
|
||||
return ClassInheritorsSearch.search(containingClass, searchScope, false).forEach(processor2);
|
||||
}
|
||||
|
||||
private static boolean processEnumReferences(@NotNull final Processor<PsiReference> processor,
|
||||
private static boolean processEnumReferences(@NotNull final Processor<? super PsiReference> processor,
|
||||
@NotNull final PsiMethod constructor,
|
||||
@NotNull final Project project,
|
||||
@NotNull final PsiClass aClass) {
|
||||
@@ -151,7 +137,7 @@ class ConstructorReferencesSearchHelper {
|
||||
});
|
||||
}
|
||||
|
||||
private static boolean process18MethodPointers(@NotNull final Processor<PsiReference> processor,
|
||||
private static boolean process18MethodPointers(@NotNull final Processor<? super PsiReference> processor,
|
||||
@NotNull final PsiMethod constructor,
|
||||
@NotNull final Project project,
|
||||
@NotNull PsiClass aClass, SearchScope searchScope) {
|
||||
@@ -181,7 +167,7 @@ class ConstructorReferencesSearchHelper {
|
||||
final boolean isStrictSignatureSearch,
|
||||
@NotNull String superOrThisKeyword,
|
||||
@NotNull String thisOrSuperKeyword,
|
||||
@NotNull Processor<PsiReference> processor) {
|
||||
@NotNull Processor<? super PsiReference> processor) {
|
||||
PsiMethod[] constructors = inheritor.getConstructors();
|
||||
if (constructors.length == 0 && constructorCanBeCalledImplicitly) {
|
||||
if (!processImplicitConstructorCall(inheritor, processor, constructor, project, inheritor)) return false;
|
||||
@@ -227,7 +213,7 @@ class ConstructorReferencesSearchHelper {
|
||||
}
|
||||
|
||||
private boolean processImplicitConstructorCall(@NotNull final PsiMember usage,
|
||||
@NotNull final Processor<PsiReference> processor,
|
||||
@NotNull final Processor<? super PsiReference> processor,
|
||||
@NotNull final PsiMethod constructor,
|
||||
@NotNull final Project project,
|
||||
@NotNull final PsiClass containingClass) {
|
||||
|
||||
+2
-1
@@ -1,3 +1,4 @@
|
||||
// Copyright 2000-2018 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.
|
||||
package com.intellij.psi.impl.search;
|
||||
|
||||
import com.intellij.openapi.application.QueryExecutorBase;
|
||||
@@ -13,7 +14,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
public class ConstructorReferencesSearcher extends QueryExecutorBase<PsiReference, ReferencesSearch.SearchParameters> {
|
||||
@Override
|
||||
public void processQuery(@NotNull final ReferencesSearch.SearchParameters p, @NotNull Processor<PsiReference> consumer) {
|
||||
public void processQuery(@NotNull final ReferencesSearch.SearchParameters p, @NotNull Processor<? super PsiReference> consumer) {
|
||||
final PsiElement element = p.getElementToSearch();
|
||||
if (!(element instanceof PsiMethod)) {
|
||||
return;
|
||||
|
||||
+2
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package com.intellij.psi.impl.search;
|
||||
|
||||
import com.intellij.openapi.application.ReadAction;
|
||||
@@ -39,7 +25,7 @@ import java.util.List;
|
||||
*/
|
||||
public class JavaAllOverridingMethodsSearcher implements QueryExecutor<Pair<PsiMethod, PsiMethod>, AllOverridingMethodsSearch.SearchParameters> {
|
||||
@Override
|
||||
public boolean execute(@NotNull final AllOverridingMethodsSearch.SearchParameters p, @NotNull final Processor<Pair<PsiMethod, PsiMethod>> consumer) {
|
||||
public boolean execute(@NotNull final AllOverridingMethodsSearch.SearchParameters p, @NotNull final Processor<? super Pair<PsiMethod, PsiMethod>> consumer) {
|
||||
final PsiClass psiClass = p.getPsiClass();
|
||||
|
||||
final List<PsiMethod> potentials = ReadAction.compute(() -> ContainerUtil.filter(psiClass.getMethods(), PsiUtil::canBeOverridden));
|
||||
|
||||
+4
-18
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package com.intellij.psi.impl.search;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
@@ -42,7 +28,7 @@ import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
public class JavaClassInheritorsSearcher extends QueryExecutorBase<PsiClass, ClassInheritorsSearch.SearchParameters> {
|
||||
@Override
|
||||
public void processQuery(@NotNull ClassInheritorsSearch.SearchParameters parameters, @NotNull Processor<PsiClass> consumer) {
|
||||
public void processQuery(@NotNull ClassInheritorsSearch.SearchParameters parameters, @NotNull Processor<? super PsiClass> consumer) {
|
||||
final PsiClass baseClass = parameters.getClassToProcess();
|
||||
assert parameters.isCheckDeep();
|
||||
assert parameters.isCheckInheritance();
|
||||
@@ -67,7 +53,7 @@ public class JavaClassInheritorsSearcher extends QueryExecutorBase<PsiClass, Cla
|
||||
}
|
||||
|
||||
private static void processInheritors(@NotNull final ClassInheritorsSearch.SearchParameters parameters,
|
||||
@NotNull final Processor<PsiClass> consumer) {
|
||||
@NotNull final Processor<? super PsiClass> consumer) {
|
||||
@NotNull final PsiClass baseClass = parameters.getClassToProcess();
|
||||
if (baseClass instanceof PsiAnonymousClass || isFinal(baseClass)) return;
|
||||
|
||||
@@ -140,7 +126,7 @@ public class JavaClassInheritorsSearcher extends QueryExecutorBase<PsiClass, Cla
|
||||
@NotNull final ClassInheritorsSearch.SearchParameters parameters,
|
||||
@NotNull LocalSearchScope searchScope,
|
||||
@NotNull PsiClass baseClass,
|
||||
@NotNull Processor<PsiClass> consumer) {
|
||||
@NotNull Processor<? super PsiClass> consumer) {
|
||||
// optimisation: in case of local scope it's considered cheaper to enumerate all scope files and check if there is an inheritor there,
|
||||
// instead of traversing the (potentially huge) class hierarchy and filter out almost everything by scope.
|
||||
VirtualFile[] virtualFiles = searchScope.getVirtualFiles();
|
||||
|
||||
+3
-5
@@ -1,6 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2018 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.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package com.intellij.psi.impl.search;
|
||||
|
||||
import com.intellij.compiler.CompilerDirectHierarchyInfo;
|
||||
@@ -43,7 +41,7 @@ import java.util.stream.Stream;
|
||||
*/
|
||||
public class JavaDirectInheritorsSearcher implements QueryExecutor<PsiClass, DirectClassInheritorsSearch.SearchParameters> {
|
||||
@Override
|
||||
public boolean execute(@NotNull final DirectClassInheritorsSearch.SearchParameters parameters, @NotNull final Processor<PsiClass> consumer) {
|
||||
public boolean execute(@NotNull final DirectClassInheritorsSearch.SearchParameters parameters, @NotNull final Processor<? super PsiClass> consumer) {
|
||||
PsiClass baseClass = getClassToSearch(parameters);
|
||||
assert parameters.isCheckInheritance();
|
||||
|
||||
@@ -282,7 +280,7 @@ public class JavaDirectInheritorsSearcher implements QueryExecutor<PsiClass, Dir
|
||||
}
|
||||
|
||||
private static boolean processInheritorCandidates(@NotNull Stream<PsiElement> classStream,
|
||||
@NotNull Processor<PsiClass> consumer,
|
||||
@NotNull Processor<? super PsiClass> consumer,
|
||||
boolean acceptAnonymous) {
|
||||
if (!acceptAnonymous) {
|
||||
classStream = classStream.filter(c -> !(c instanceof PsiAnonymousClass));
|
||||
|
||||
+4
-4
@@ -51,7 +51,7 @@ public class JavaFunctionalExpressionSearcher extends QueryExecutorBase<PsiFunct
|
||||
public static final int SMART_SEARCH_THRESHOLD = 5;
|
||||
|
||||
@Override
|
||||
public void processQuery(@NotNull SearchParameters p, @NotNull Processor<PsiFunctionalExpression> consumer) {
|
||||
public void processQuery(@NotNull SearchParameters p, @NotNull Processor<? super PsiFunctionalExpression> consumer) {
|
||||
List<SamDescriptor> descriptors = calcDescriptors(p);
|
||||
Project project = PsiUtilCore.getProjectInReadAction(p.getElementToSearch());
|
||||
if (project == null) return;
|
||||
@@ -178,7 +178,7 @@ public class JavaFunctionalExpressionSearcher extends QueryExecutorBase<PsiFunct
|
||||
: ContainerUtil.filter(occurrences, it -> it.canHaveType(samClasses, vFile)));
|
||||
}
|
||||
|
||||
private static boolean processFile(@NotNull Processor<PsiFunctionalExpression> consumer,
|
||||
private static boolean processFile(@NotNull Processor<? super PsiFunctionalExpression> consumer,
|
||||
List<SamDescriptor> descriptors,
|
||||
VirtualFile vFile, Collection<Integer> offsets) {
|
||||
return ReadAction.compute(() -> {
|
||||
@@ -332,7 +332,7 @@ public class JavaFunctionalExpressionSearcher extends QueryExecutorBase<PsiFunct
|
||||
private static boolean performSearchUsingCompilerIndices(@NotNull List<SamDescriptor> descriptors,
|
||||
@NotNull GlobalSearchScope searchScope,
|
||||
@NotNull Project project,
|
||||
@NotNull Processor<PsiFunctionalExpression> consumer) {
|
||||
@NotNull Processor<? super PsiFunctionalExpression> consumer) {
|
||||
CompilerReferenceService compilerReferenceService = CompilerReferenceService.getInstance(project);
|
||||
if (compilerReferenceService == null) return true;
|
||||
for (SamDescriptor descriptor : descriptors) {
|
||||
@@ -354,7 +354,7 @@ public class JavaFunctionalExpressionSearcher extends QueryExecutorBase<PsiFunct
|
||||
|
||||
private static boolean processFunctionalExpressions(@Nullable CompilerDirectHierarchyInfo funExprInfo,
|
||||
@NotNull SamDescriptor descriptor,
|
||||
@NotNull Processor<PsiFunctionalExpression> consumer) {
|
||||
@NotNull Processor<? super PsiFunctionalExpression> consumer) {
|
||||
if (funExprInfo != null) {
|
||||
if (!ContainerUtil.process(funExprInfo.getHierarchyChildren().iterator(), fe -> consumer.process((PsiFunctionalExpression)fe))) return false;
|
||||
GlobalSearchScope dirtyScope = funExprInfo.getDirtyScope();
|
||||
|
||||
+2
-2
@@ -31,7 +31,7 @@ import java.util.LinkedHashSet;
|
||||
*/
|
||||
public class JavaOverridingMethodsSearcher implements QueryExecutor<PsiMethod, OverridingMethodsSearch.SearchParameters> {
|
||||
@Override
|
||||
public boolean execute(@NotNull final OverridingMethodsSearch.SearchParameters parameters, @NotNull final Processor<PsiMethod> consumer) {
|
||||
public boolean execute(@NotNull final OverridingMethodsSearch.SearchParameters parameters, @NotNull final Processor<? super PsiMethod> consumer) {
|
||||
final PsiMethod method = parameters.getMethod();
|
||||
|
||||
Project project = ReadAction.compute(method::getProject);
|
||||
@@ -72,7 +72,7 @@ public class JavaOverridingMethodsSearcher implements QueryExecutor<PsiMethod, O
|
||||
private static boolean processLocalScope(@NotNull LocalSearchScope searchScope,
|
||||
@NotNull PsiMethod method,
|
||||
@NotNull Project project,
|
||||
@NotNull final Processor<PsiMethod> consumer) {
|
||||
@NotNull final Processor<? super PsiMethod> consumer) {
|
||||
// optimisation: in case of local scope it's considered cheaper to enumerate all scope files and check if there is an inheritor there,
|
||||
// instead of traversing the (potentially huge) class hierarchy and filter out almost everything by scope.
|
||||
VirtualFile[] virtualFiles = searchScope.getVirtualFiles();
|
||||
|
||||
+4
-18
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package com.intellij.psi.impl.search;
|
||||
|
||||
import com.intellij.openapi.application.ReadAction;
|
||||
@@ -29,11 +15,11 @@ import java.util.Set;
|
||||
*/
|
||||
public class MethodDeepestSuperSearcher implements QueryExecutor<PsiMethod, PsiMethod> {
|
||||
@Override
|
||||
public boolean execute(@NotNull PsiMethod method, @NotNull Processor<PsiMethod> consumer) {
|
||||
public boolean execute(@NotNull PsiMethod method, @NotNull Processor<? super PsiMethod> consumer) {
|
||||
return processDeepestSuperMethods(method, consumer);
|
||||
}
|
||||
|
||||
public static boolean processDeepestSuperMethods(@NotNull PsiMethod method, @NotNull Processor<PsiMethod> consumer) {
|
||||
public static boolean processDeepestSuperMethods(@NotNull PsiMethod method, @NotNull Processor<? super PsiMethod> consumer) {
|
||||
final Set<PsiMethod> methods = new THashSet<>();
|
||||
methods.add(method);
|
||||
return findDeepestSuperOrSelfSignature(method, methods, null, consumer);
|
||||
@@ -42,7 +28,7 @@ public class MethodDeepestSuperSearcher implements QueryExecutor<PsiMethod, PsiM
|
||||
private static boolean findDeepestSuperOrSelfSignature(@NotNull PsiMethod method,
|
||||
@NotNull Set<PsiMethod> set,
|
||||
Set<PsiMethod> guard,
|
||||
@NotNull Processor<PsiMethod> processor) {
|
||||
@NotNull Processor<? super PsiMethod> processor) {
|
||||
if (guard != null && !guard.add(method)) return true;
|
||||
PsiMethod[] supers = ReadAction.compute(() -> method.findSuperMethods());
|
||||
|
||||
|
||||
+4
-18
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package com.intellij.psi.impl.search;
|
||||
|
||||
import com.intellij.psi.*;
|
||||
@@ -42,7 +28,7 @@ public class MethodTextOccurrenceProcessor extends RequestResultProcessor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean processTextOccurrence(@NotNull PsiElement element, int offsetInElement, @NotNull final Processor<PsiReference> consumer) {
|
||||
public final boolean processTextOccurrence(@NotNull PsiElement element, int offsetInElement, @NotNull final Processor<? super PsiReference> consumer) {
|
||||
for (PsiReference ref : ourReferenceService.getReferences(element, new PsiReferenceService.Hints(myMethods[0], offsetInElement))) {
|
||||
if (ReferenceRange.containsOffsetInElement(ref, offsetInElement) && !processReference(consumer, ref)) {
|
||||
return false;
|
||||
@@ -51,7 +37,7 @@ public class MethodTextOccurrenceProcessor extends RequestResultProcessor {
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean processReference(Processor<PsiReference> consumer, PsiReference ref) {
|
||||
private boolean processReference(Processor<? super PsiReference> consumer, PsiReference ref) {
|
||||
for (PsiMethod method : myMethods) {
|
||||
if (!method.isValid()) {
|
||||
continue;
|
||||
@@ -72,7 +58,7 @@ public class MethodTextOccurrenceProcessor extends RequestResultProcessor {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean processInexactReference(PsiReference ref, PsiElement refElement, PsiMethod method, Processor<PsiReference> consumer) {
|
||||
protected boolean processInexactReference(PsiReference ref, PsiElement refElement, PsiMethod method, Processor<? super PsiReference> consumer) {
|
||||
if (refElement instanceof PsiMethod) {
|
||||
PsiMethod refMethod = (PsiMethod)refElement;
|
||||
PsiClass refMethodClass = refMethod.getContainingClass();
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package com.intellij.psi.impl.search;
|
||||
|
||||
import com.intellij.openapi.application.QueryExecutorBase;
|
||||
@@ -34,7 +20,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
public class MethodUsagesSearcher extends QueryExecutorBase<PsiReference, MethodReferencesSearch.SearchParameters> {
|
||||
@Override
|
||||
public void processQuery(@NotNull final MethodReferencesSearch.SearchParameters p, @NotNull final Processor<PsiReference> consumer) {
|
||||
public void processQuery(@NotNull final MethodReferencesSearch.SearchParameters p, @NotNull final Processor<? super PsiReference> consumer) {
|
||||
final PsiMethod method = p.getMethod();
|
||||
final boolean[] isConstructor = new boolean[1];
|
||||
final PsiManager[] psiManager = new PsiManager[1];
|
||||
|
||||
+3
-17
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package com.intellij.psi.impl.search;
|
||||
|
||||
import com.intellij.openapi.application.ReadAction;
|
||||
@@ -31,7 +17,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
public class PsiAnnotationMethodReferencesSearcher implements QueryExecutor<PsiReference, ReferencesSearch.SearchParameters> {
|
||||
@Override
|
||||
public boolean execute(@NotNull final ReferencesSearch.SearchParameters p, @NotNull final Processor<PsiReference> consumer) {
|
||||
public boolean execute(@NotNull final ReferencesSearch.SearchParameters p, @NotNull final Processor<? super PsiReference> consumer) {
|
||||
final PsiElement refElement = p.getElementToSearch();
|
||||
boolean isAnnotation = ReadAction.compute(() -> PsiUtil.isAnnotationMethod(refElement));
|
||||
if (isAnnotation) {
|
||||
@@ -52,7 +38,7 @@ public class PsiAnnotationMethodReferencesSearcher implements QueryExecutor<PsiR
|
||||
}
|
||||
|
||||
@NotNull
|
||||
static ReadActionProcessor<PsiReference> createImplicitDefaultAnnotationMethodConsumer(@NotNull Processor<PsiReference> consumer) {
|
||||
static ReadActionProcessor<PsiReference> createImplicitDefaultAnnotationMethodConsumer(@NotNull Processor<? super PsiReference> consumer) {
|
||||
return new ReadActionProcessor<PsiReference>() {
|
||||
@Override
|
||||
public boolean processInReadAction(final PsiReference reference) {
|
||||
|
||||
+2
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package com.intellij.psi.impl.search;
|
||||
|
||||
import com.intellij.lang.spi.SPILanguage;
|
||||
@@ -33,7 +19,7 @@ public class SPIReferencesSearcher extends QueryExecutorBase<PsiReference, Refer
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processQuery(@NotNull final ReferencesSearch.SearchParameters p, @NotNull final Processor<PsiReference> consumer) {
|
||||
public void processQuery(@NotNull final ReferencesSearch.SearchParameters p, @NotNull final Processor<? super PsiReference> consumer) {
|
||||
final PsiElement element = p.getElementToSearch();
|
||||
if (!element.isValid()) return;
|
||||
|
||||
|
||||
+2
-17
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package com.intellij.psi.impl.search;
|
||||
|
||||
import com.intellij.openapi.application.QueryExecutorBase;
|
||||
@@ -26,7 +12,6 @@ import com.intellij.psi.search.SearchRequestCollector;
|
||||
import com.intellij.psi.search.SearchScope;
|
||||
import com.intellij.psi.search.UsageSearchContext;
|
||||
import com.intellij.psi.search.searches.ReferencesSearch;
|
||||
import com.intellij.psi.util.PropertyUtil;
|
||||
import com.intellij.psi.util.PropertyUtilBase;
|
||||
import com.intellij.util.Processor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -40,7 +25,7 @@ public class SimpleAccessorReferenceSearcher extends QueryExecutorBase<PsiRefere
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processQuery(@NotNull ReferencesSearch.SearchParameters queryParameters, @NotNull Processor<PsiReference> consumer) {
|
||||
public void processQuery(@NotNull ReferencesSearch.SearchParameters queryParameters, @NotNull Processor<? super PsiReference> consumer) {
|
||||
PsiElement refElement = queryParameters.getElementToSearch();
|
||||
if (!(refElement instanceof PsiMethod)) return;
|
||||
|
||||
|
||||
+3
-17
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package com.intellij.psi.impl.search;
|
||||
|
||||
import com.intellij.openapi.application.QueryExecutorBase;
|
||||
@@ -53,7 +39,7 @@ public class StubHierarchyInheritorSearcher extends QueryExecutorBase<PsiClass,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processQuery(@NotNull DirectClassInheritorsSearch.SearchParameters p, @NotNull Processor<PsiClass> consumer) {
|
||||
public void processQuery(@NotNull DirectClassInheritorsSearch.SearchParameters p, @NotNull Processor<? super PsiClass> consumer) {
|
||||
if (!(p.getScope() instanceof GlobalSearchScope) || !isSearching()) return;
|
||||
|
||||
PsiClass base = p.getClassToProcess();
|
||||
@@ -71,7 +57,7 @@ public class StubHierarchyInheritorSearcher extends QueryExecutorBase<PsiClass,
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean processCandidate(Processor<PsiClass> consumer,
|
||||
private static boolean processCandidate(Processor<? super PsiClass> consumer,
|
||||
PsiClass base,
|
||||
GlobalSearchScope scope,
|
||||
ClassHierarchy hierarchy, SmartClassAnchor anchor) {
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ public class VariableInIncompleteCodeSearcher extends QueryExecutorBase<PsiRefer
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processQuery(@NotNull final ReferencesSearch.SearchParameters p, @NotNull final Processor<PsiReference> consumer) {
|
||||
public void processQuery(@NotNull final ReferencesSearch.SearchParameters p, @NotNull final Processor<? super PsiReference> consumer) {
|
||||
final PsiElement refElement = p.getElementToSearch();
|
||||
if (!refElement.isValid() || !(refElement instanceof PsiVariable)) return;
|
||||
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package com.intellij.psi.impl.search;
|
||||
|
||||
import com.intellij.openapi.application.ReadAction;
|
||||
@@ -35,7 +21,7 @@ public class MethodSuperSearcher implements QueryExecutor<MethodSignatureBackedB
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.search.MethodSuperSearcher");
|
||||
|
||||
@Override
|
||||
public boolean execute(@NotNull final SuperMethodsSearch.SearchParameters queryParameters, @NotNull final Processor<MethodSignatureBackedByPsiMethod> consumer) {
|
||||
public boolean execute(@NotNull final SuperMethodsSearch.SearchParameters queryParameters, @NotNull final Processor<? super MethodSignatureBackedByPsiMethod> consumer) {
|
||||
final PsiClass parentClass = queryParameters.getPsiClass();
|
||||
final PsiMethod method = queryParameters.getMethod();
|
||||
return ReadAction.compute(() -> {
|
||||
@@ -59,7 +45,7 @@ public class MethodSuperSearcher implements QueryExecutor<MethodSignatureBackedB
|
||||
final PsiClass parentClass,
|
||||
final boolean allowStaticMethod,
|
||||
final boolean checkBases,
|
||||
final Processor<MethodSignatureBackedByPsiMethod> consumer) {
|
||||
final Processor<? super MethodSignatureBackedByPsiMethod> consumer) {
|
||||
PsiMethod signatureMethod = signature.getMethod();
|
||||
PsiClass hisClass = signatureMethod.getContainingClass();
|
||||
if (parentClass == null || InheritanceUtil.isInheritorOrSelf(parentClass, hisClass, true)) {
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
|
||||
package com.intellij.psi.impl.search;
|
||||
|
||||
@@ -53,7 +39,7 @@ import java.util.regex.Pattern;
|
||||
public class IndexPatternSearcher implements QueryExecutor<IndexPatternOccurrence, IndexPatternSearch.SearchParameters> {
|
||||
@Override
|
||||
public boolean execute(@NotNull final IndexPatternSearch.SearchParameters queryParameters,
|
||||
@NotNull final Processor<IndexPatternOccurrence> consumer) {
|
||||
@NotNull final Processor<? super IndexPatternOccurrence> consumer) {
|
||||
final PsiFile file = queryParameters.getFile();
|
||||
VirtualFile virtualFile = file.getVirtualFile();
|
||||
if (file instanceof PsiBinaryFile || file instanceof PsiCompiledElement || virtualFile == null) {
|
||||
@@ -69,7 +55,7 @@ public class IndexPatternSearcher implements QueryExecutor<IndexPatternOccurrenc
|
||||
}
|
||||
|
||||
protected static boolean executeImpl(IndexPatternSearch.SearchParameters queryParameters,
|
||||
Processor<IndexPatternOccurrence> consumer) {
|
||||
Processor<? super IndexPatternOccurrence> consumer) {
|
||||
final IndexPatternProvider patternProvider = queryParameters.getPatternProvider();
|
||||
final PsiFile file = queryParameters.getFile();
|
||||
TIntArrayList commentStarts = new TIntArrayList();
|
||||
@@ -282,7 +268,7 @@ public class IndexPatternSearcher implements QueryExecutor<IndexPatternOccurrenc
|
||||
int commentEnd,
|
||||
PsiFile file,
|
||||
TextRange range,
|
||||
Processor<IndexPatternOccurrence> consumer,
|
||||
Processor<? super IndexPatternOccurrence> consumer,
|
||||
TIntArrayList matches
|
||||
) {
|
||||
Pattern pattern = indexPattern.getPattern();
|
||||
|
||||
+2
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package com.intellij.psi.impl.search;
|
||||
|
||||
import com.intellij.psi.search.IndexPatternOccurrence;
|
||||
@@ -26,7 +12,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
public class LightIndexPatternSearcher extends IndexPatternSearcher {
|
||||
@Override
|
||||
public boolean execute(@NotNull IndexPatternSearch.SearchParameters queryParameters,
|
||||
@NotNull Processor<IndexPatternOccurrence> consumer) {
|
||||
@NotNull Processor<? super IndexPatternOccurrence> consumer) {
|
||||
return executeImpl(queryParameters, consumer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,10 +152,10 @@ public interface PsiSearchHelper {
|
||||
*/
|
||||
boolean processAllFilesWithWordInLiterals(@NotNull String word, @NotNull GlobalSearchScope scope, @NotNull Processor<PsiFile> processor);
|
||||
|
||||
boolean processRequests(@NotNull SearchRequestCollector request, @NotNull Processor<PsiReference> processor);
|
||||
boolean processRequests(@NotNull SearchRequestCollector request, @NotNull Processor<? super PsiReference> processor);
|
||||
|
||||
@NotNull
|
||||
AsyncFuture<Boolean> processRequestsAsync(@NotNull SearchRequestCollector request, @NotNull Processor<PsiReference> processor);
|
||||
AsyncFuture<Boolean> processRequestsAsync(@NotNull SearchRequestCollector request, @NotNull Processor<? super PsiReference> processor);
|
||||
|
||||
boolean processElementsWithWord(@NotNull TextOccurenceProcessor processor,
|
||||
@NotNull SearchScope searchScope,
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package com.intellij.psi.search;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
@@ -64,7 +50,7 @@ public abstract class RequestResultProcessor {
|
||||
*
|
||||
* @return whether the consumer has returned false for any of the references (and thus stopped searching), false otherwise.
|
||||
*/
|
||||
public abstract boolean processTextOccurrence(@NotNull PsiElement element, int offsetInElement, @NotNull Processor<PsiReference> consumer);
|
||||
public abstract boolean processTextOccurrence(@NotNull PsiElement element, int offsetInElement, @NotNull Processor<? super PsiReference> consumer);
|
||||
|
||||
/**
|
||||
* A variant of {@link RequestResultProcessor} that processes all text occurrences at once, e.g. for performance purposes.
|
||||
@@ -81,7 +67,7 @@ public abstract class RequestResultProcessor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean processTextOccurrence(@NotNull PsiElement element, int offsetInElement, @NotNull Processor<PsiReference> consumer) {
|
||||
public boolean processTextOccurrence(@NotNull PsiElement element, int offsetInElement, @NotNull Processor<? super PsiReference> consumer) {
|
||||
return processTextOccurrences(element, new int[]{offsetInElement}, consumer);
|
||||
}
|
||||
|
||||
@@ -91,6 +77,6 @@ public abstract class RequestResultProcessor {
|
||||
* inside the given element at the given offsets, and feed them to {@code consumer}.<p/>
|
||||
* @return whether the consumer has returned false for any of the references (and thus stopped searching), false otherwise.
|
||||
*/
|
||||
public abstract boolean processTextOccurrences(@NotNull PsiElement scope, int[] offsetsInScope, @NotNull Processor<PsiReference> consumer);
|
||||
public abstract boolean processTextOccurrences(@NotNull PsiElement scope, int[] offsetsInScope, @NotNull Processor<? super PsiReference> consumer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package com.intellij.psi.search;
|
||||
|
||||
import com.intellij.codeInsight.ContainerProvider;
|
||||
@@ -41,7 +27,7 @@ public class SearchRequestCollector {
|
||||
private final Object lock = new Object();
|
||||
private final List<PsiSearchRequest> myWordRequests = new ArrayList<>();
|
||||
private final List<QuerySearchRequest> myQueryRequests = new ArrayList<>();
|
||||
private final List<Processor<Processor<PsiReference>>> myCustomSearchActions = new ArrayList<>();
|
||||
private final List<Processor<Processor<? super PsiReference>>> myCustomSearchActions = new ArrayList<>();
|
||||
private final SearchSession mySession;
|
||||
|
||||
public SearchRequestCollector(@NotNull SearchSession session) {
|
||||
@@ -156,7 +142,7 @@ public class SearchRequestCollector {
|
||||
}
|
||||
}
|
||||
|
||||
public void searchCustom(@NotNull Processor<Processor<PsiReference>> searchAction) {
|
||||
public void searchCustom(@NotNull Processor<Processor<? super PsiReference>> searchAction) {
|
||||
synchronized (lock) {
|
||||
myCustomSearchActions.add(searchAction);
|
||||
}
|
||||
@@ -182,7 +168,7 @@ public class SearchRequestCollector {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<Processor<Processor<PsiReference>>> takeCustomSearchActions() {
|
||||
public List<Processor<Processor<? super PsiReference>>> takeCustomSearchActions() {
|
||||
return takeRequests(myCustomSearchActions);
|
||||
}
|
||||
|
||||
|
||||
+2
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package com.intellij.psi.search;
|
||||
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
@@ -38,7 +24,7 @@ public final class SingleTargetRequestResultProcessor extends RequestResultProce
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean processTextOccurrence(@NotNull PsiElement element, int offsetInElement, @NotNull final Processor<PsiReference> consumer) {
|
||||
public boolean processTextOccurrence(@NotNull PsiElement element, int offsetInElement, @NotNull final Processor<? super PsiReference> consumer) {
|
||||
if (!myTarget.isValid()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ public class ReferencesSearch extends ExtensibleQueryFactory<PsiReference, Refer
|
||||
@NotNull SearchScope searchScope,
|
||||
boolean ignoreAccessScope,
|
||||
@NotNull SearchRequestCollector collector,
|
||||
@NotNull final Processor<PsiReference> processor) {
|
||||
@NotNull final Processor<? super PsiReference> processor) {
|
||||
searchOptimized(element, searchScope, ignoreAccessScope, collector, false,
|
||||
(psiReference, collector1) -> processor.process(psiReference));
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Copyright 2000-2018 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.
|
||||
package com.intellij.psi.impl.search;
|
||||
|
||||
import com.intellij.openapi.application.QueryExecutorBase;
|
||||
@@ -24,7 +25,7 @@ public class CachesBasedRefSearcher extends QueryExecutorBase<PsiReference, Refe
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processQuery(@NotNull ReferencesSearch.SearchParameters p, @NotNull Processor<PsiReference> consumer) {
|
||||
public void processQuery(@NotNull ReferencesSearch.SearchParameters p, @NotNull Processor<? super PsiReference> consumer) {
|
||||
final PsiElement refElement = p.getElementToSearch();
|
||||
boolean caseSensitive = refElement.getLanguage().isCaseSensitive();
|
||||
|
||||
|
||||
@@ -560,16 +560,16 @@ public class PsiSearchHelperImpl implements PsiSearchHelper {
|
||||
|
||||
private static class RequestWithProcessor {
|
||||
@NotNull private final PsiSearchRequest request;
|
||||
@NotNull private Processor<PsiReference> refProcessor;
|
||||
@NotNull private Processor<? super PsiReference> refProcessor;
|
||||
|
||||
private RequestWithProcessor(@NotNull PsiSearchRequest request, @NotNull Processor<PsiReference> processor) {
|
||||
private RequestWithProcessor(@NotNull PsiSearchRequest request, @NotNull Processor<? super PsiReference> processor) {
|
||||
this.request = request;
|
||||
refProcessor = processor;
|
||||
}
|
||||
|
||||
private boolean uniteWith(@NotNull final RequestWithProcessor another) {
|
||||
if (request.equals(another.request)) {
|
||||
final Processor<PsiReference> myProcessor = refProcessor;
|
||||
final Processor<? super PsiReference> myProcessor = refProcessor;
|
||||
if (myProcessor != another.refProcessor) {
|
||||
refProcessor = psiReference -> myProcessor.process(psiReference) && another.refProcessor.process(psiReference);
|
||||
}
|
||||
@@ -585,8 +585,8 @@ public class PsiSearchHelperImpl implements PsiSearchHelper {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean processRequests(@NotNull SearchRequestCollector collector, @NotNull Processor<PsiReference> processor) {
|
||||
final Map<SearchRequestCollector, Processor<PsiReference>> collectors = ContainerUtil.newHashMap();
|
||||
public boolean processRequests(@NotNull SearchRequestCollector collector, @NotNull Processor<? super PsiReference> processor) {
|
||||
final Map<SearchRequestCollector, Processor<? super PsiReference>> collectors = ContainerUtil.newHashMap();
|
||||
collectors.put(collector, processor);
|
||||
|
||||
ProgressIndicator progress = getOrCreateIndicator();
|
||||
@@ -621,11 +621,11 @@ public class PsiSearchHelperImpl implements PsiSearchHelper {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public AsyncFuture<Boolean> processRequestsAsync(@NotNull SearchRequestCollector collector, @NotNull Processor<PsiReference> processor) {
|
||||
public AsyncFuture<Boolean> processRequestsAsync(@NotNull SearchRequestCollector collector, @NotNull Processor<? super PsiReference> processor) {
|
||||
return AsyncUtil.wrapBoolean(processRequests(collector, processor));
|
||||
}
|
||||
|
||||
private static boolean appendCollectorsFromQueryRequests(@NotNull Map<SearchRequestCollector, Processor<PsiReference>> collectors) {
|
||||
private static boolean appendCollectorsFromQueryRequests(@NotNull Map<SearchRequestCollector, Processor<? super PsiReference>> collectors) {
|
||||
boolean changed = false;
|
||||
Deque<SearchRequestCollector> queue = new LinkedList<>(collectors.keySet());
|
||||
while (!queue.isEmpty()) {
|
||||
@@ -736,7 +736,7 @@ public class PsiSearchHelperImpl implements PsiSearchHelper {
|
||||
|
||||
@NotNull
|
||||
private static BulkOccurrenceProcessor adaptProcessor(@NotNull PsiSearchRequest singleRequest,
|
||||
@NotNull Processor<PsiReference> consumer) {
|
||||
@NotNull Processor<? super PsiReference> consumer) {
|
||||
final SearchScope searchScope = singleRequest.searchScope;
|
||||
final boolean ignoreInjectedPsi = searchScope instanceof LocalSearchScope && ((LocalSearchScope)searchScope).isIgnoreInjectedPsi();
|
||||
final RequestResultProcessor wrapped = singleRequest.processor;
|
||||
@@ -864,15 +864,15 @@ public class PsiSearchHelperImpl implements PsiSearchHelper {
|
||||
return GlobalSearchScope.union(scopes.toArray(new GlobalSearchScope[0]));
|
||||
}
|
||||
|
||||
private static void distributePrimitives(@NotNull Map<SearchRequestCollector, Processor<PsiReference>> collectors,
|
||||
private static void distributePrimitives(@NotNull Map<SearchRequestCollector, Processor<? super PsiReference>> collectors,
|
||||
@NotNull Set<RequestWithProcessor> locals,
|
||||
@NotNull MultiMap<Set<IdIndexEntry>, RequestWithProcessor> globals,
|
||||
@NotNull List<Computable<Boolean>> customs,
|
||||
@NotNull Map<RequestWithProcessor, Processor<PsiElement>> localProcessors,
|
||||
@NotNull ProgressIndicator progress) {
|
||||
for (final Map.Entry<SearchRequestCollector, Processor<PsiReference>> entry : collectors.entrySet()) {
|
||||
for (final Map.Entry<SearchRequestCollector, Processor<? super PsiReference>> entry : collectors.entrySet()) {
|
||||
ProgressManager.checkCanceled();
|
||||
final Processor<PsiReference> processor = entry.getValue();
|
||||
final Processor<? super PsiReference> processor = entry.getValue();
|
||||
SearchRequestCollector collector = entry.getKey();
|
||||
for (final PsiSearchRequest primitive : collector.takeSearchRequests()) {
|
||||
ProgressManager.checkCanceled();
|
||||
@@ -885,7 +885,7 @@ public class PsiSearchHelperImpl implements PsiSearchHelper {
|
||||
registerRequest(globals.getModifiable(key), primitive, processor);
|
||||
}
|
||||
}
|
||||
for (final Processor<Processor<PsiReference>> customAction : collector.takeCustomSearchActions()) {
|
||||
for (final Processor<Processor<? super PsiReference>> customAction : collector.takeCustomSearchActions()) {
|
||||
ProgressManager.checkCanceled();
|
||||
customs.add(() -> customAction.process(processor));
|
||||
}
|
||||
@@ -909,7 +909,7 @@ public class PsiSearchHelperImpl implements PsiSearchHelper {
|
||||
|
||||
private static void registerRequest(@NotNull Collection<RequestWithProcessor> collection,
|
||||
@NotNull PsiSearchRequest primitive,
|
||||
@NotNull Processor<PsiReference> processor) {
|
||||
@NotNull Processor<? super PsiReference> processor) {
|
||||
RequestWithProcessor singleRequest = new RequestWithProcessor(primitive, processor);
|
||||
|
||||
for (RequestWithProcessor existing : collection) {
|
||||
@@ -921,7 +921,7 @@ public class PsiSearchHelperImpl implements PsiSearchHelper {
|
||||
collection.add(singleRequest);
|
||||
}
|
||||
|
||||
private boolean processSingleRequest(@NotNull PsiSearchRequest single, @NotNull Processor<PsiReference> consumer) {
|
||||
private boolean processSingleRequest(@NotNull PsiSearchRequest single, @NotNull Processor<? super PsiReference> consumer) {
|
||||
final EnumSet<Options> options = EnumSet.of(Options.PROCESS_ONLY_JAVA_IDENTIFIERS_IF_POSSIBLE);
|
||||
if (single.caseSensitive) options.add(Options.CASE_SENSITIVE_SEARCH);
|
||||
if (shouldProcessInjectedPsi(single.searchScope)) options.add(Options.PROCESS_INJECTED_PSI);
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package com.intellij.pom;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
@@ -26,7 +12,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
public class PomDefinitionSearch implements QueryExecutor<PsiElement, PsiElement> {
|
||||
@Override
|
||||
public boolean execute(@NotNull PsiElement queryParameters, @NotNull Processor<PsiElement> consumer) {
|
||||
public boolean execute(@NotNull PsiElement queryParameters, @NotNull Processor<? super PsiElement> consumer) {
|
||||
if (queryParameters instanceof PomTargetPsiElement) {
|
||||
final PomTarget target = ((PomTargetPsiElement)queryParameters).getTarget();
|
||||
if (target instanceof PsiTarget) {
|
||||
|
||||
+2
-1
@@ -1,3 +1,4 @@
|
||||
// Copyright 2000-2018 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.
|
||||
package com.intellij.psi.impl.search;
|
||||
|
||||
import com.intellij.ide.scratch.ScratchFileService;
|
||||
@@ -25,7 +26,7 @@ public class NonPhysicalReferenceSearcher extends QueryExecutorBase<PsiReference
|
||||
super(true);
|
||||
}
|
||||
|
||||
public void processQuery(@NotNull ReferencesSearch.SearchParameters queryParameters, @NotNull Processor<PsiReference> consumer) {
|
||||
public void processQuery(@NotNull ReferencesSearch.SearchParameters queryParameters, @NotNull Processor<? super PsiReference> consumer) {
|
||||
if (ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package org.jetbrains.idea.devkit.references;
|
||||
|
||||
import com.intellij.codeInsight.daemon.EmptyResolveMessageProvider;
|
||||
@@ -71,7 +57,7 @@ public class IconsReferencesContributor extends PsiReferenceContributor
|
||||
implements QueryExecutor<PsiReference, ReferencesSearch.SearchParameters> {
|
||||
|
||||
@Override
|
||||
public boolean execute(@NotNull ReferencesSearch.SearchParameters queryParameters, @NotNull final Processor<PsiReference> consumer) {
|
||||
public boolean execute(@NotNull ReferencesSearch.SearchParameters queryParameters, @NotNull final Processor<? super PsiReference> consumer) {
|
||||
final PsiElement file = queryParameters.getElementToSearch();
|
||||
if (file instanceof PsiBinaryFile) {
|
||||
final Module module = ReadAction.compute(() -> ModuleUtilCore.findModuleForPsiElement(file));
|
||||
|
||||
+2
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
|
||||
package org.jetbrains.plugins.groovy.findUsages;
|
||||
|
||||
@@ -40,7 +26,7 @@ public class AccessorReferencesSearcher extends QueryExecutorBase<PsiReference,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processQuery(@NotNull ReferencesSearch.SearchParameters queryParameters, @NotNull Processor<PsiReference> consumer) {
|
||||
public void processQuery(@NotNull ReferencesSearch.SearchParameters queryParameters, @NotNull Processor<? super PsiReference> consumer) {
|
||||
final PsiElement element = queryParameters.getElementToSearch();
|
||||
if (element instanceof PsiMethod) {
|
||||
final String propertyName = GroovyPropertyUtils.getPropertyName((PsiMethod)element);
|
||||
|
||||
+2
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package org.jetbrains.plugins.groovy.findUsages;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
@@ -70,7 +56,7 @@ public class AnnotatedMembersSearcher implements QueryExecutor<PsiModifierListOw
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(@NotNull final AnnotatedElementsSearch.Parameters p, @NotNull final Processor<PsiModifierListOwner> consumer) {
|
||||
public boolean execute(@NotNull final AnnotatedElementsSearch.Parameters p, @NotNull final Processor<? super PsiModifierListOwner> consumer) {
|
||||
final PsiClass annClass = p.getAnnotationClass();
|
||||
assert annClass.isAnnotationType() : "Annotation type should be passed to annotated members search";
|
||||
|
||||
|
||||
+2
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package org.jetbrains.plugins.groovy.findUsages;
|
||||
|
||||
import com.intellij.openapi.application.QueryExecutorBase;
|
||||
@@ -32,7 +18,7 @@ public class ConstructorReferencesSearcher extends QueryExecutorBase<PsiReferenc
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processQuery(@NotNull ReferencesSearch.SearchParameters queryParameters, @NotNull Processor<PsiReference> consumer) {
|
||||
public void processQuery(@NotNull ReferencesSearch.SearchParameters queryParameters, @NotNull Processor<? super PsiReference> consumer) {
|
||||
final PsiElement element = queryParameters.getElementToSearch();
|
||||
if (element instanceof PsiMethod) {
|
||||
final PsiMethod method = (PsiMethod)element;
|
||||
|
||||
+2
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
|
||||
package org.jetbrains.plugins.groovy.findUsages;
|
||||
|
||||
@@ -47,7 +33,7 @@ public class GDKSuperMethodSearcher implements QueryExecutor<MethodSignatureBack
|
||||
private static final DGMMemberContributor myContributor = NonCodeMembersContributor.EP_NAME.findExtension(DGMMemberContributor.class);
|
||||
|
||||
@Override
|
||||
public boolean execute(@NotNull SuperMethodsSearch.SearchParameters queryParameters, @NotNull Processor<MethodSignatureBackedByPsiMethod> consumer) {
|
||||
public boolean execute(@NotNull SuperMethodsSearch.SearchParameters queryParameters, @NotNull Processor<? super MethodSignatureBackedByPsiMethod> consumer) {
|
||||
final PsiMethod method = queryParameters.getMethod();
|
||||
if (!(method instanceof GrMethod)) {
|
||||
return true;
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ public class GrAliasedImportedElementSearcher extends QueryExecutorBase<PsiRefer
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processQuery(@NotNull ReferencesSearch.SearchParameters parameters, @NotNull Processor<PsiReference> consumer) {
|
||||
public void processQuery(@NotNull ReferencesSearch.SearchParameters parameters, @NotNull Processor<? super PsiReference> consumer) {
|
||||
final PsiElement target = parameters.getElementToSearch();
|
||||
if (!(target instanceof PsiMember) || !(target instanceof PsiNamedElement)) return;
|
||||
|
||||
@@ -64,7 +64,7 @@ public class GrAliasedImportedElementSearcher extends QueryExecutorBase<PsiRefer
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean processTextOccurrence(@NotNull final PsiElement element, int offsetInElement, @NotNull Processor<PsiReference> consumer) {
|
||||
public boolean processTextOccurrence(@NotNull final PsiElement element, int offsetInElement, @NotNull Processor<? super PsiReference> consumer) {
|
||||
String alias = getAlias(element);
|
||||
if (alias == null) return true;
|
||||
|
||||
|
||||
+2
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package org.jetbrains.plugins.groovy.findUsages;
|
||||
|
||||
import com.intellij.openapi.application.QueryExecutorBase;
|
||||
@@ -34,7 +20,7 @@ import java.util.List;
|
||||
*/
|
||||
public class GrLiteralMethodSearcher extends QueryExecutorBase<PsiReference, MethodReferencesSearch.SearchParameters> {
|
||||
@Override
|
||||
public void processQuery(@NotNull MethodReferencesSearch.SearchParameters p, @NotNull Processor<PsiReference> consumer) {
|
||||
public void processQuery(@NotNull MethodReferencesSearch.SearchParameters p, @NotNull Processor<? super PsiReference> consumer) {
|
||||
final PsiMethod method = p.getMethod();
|
||||
final PsiClass aClass = method.getContainingClass();
|
||||
if (aClass == null) return;
|
||||
|
||||
+5
-19
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
|
||||
package org.jetbrains.plugins.groovy.findUsages;
|
||||
|
||||
@@ -63,14 +49,14 @@ public class GroovyConstructorUsagesSearcher extends QueryExecutorBase<PsiRefere
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processQuery(@NotNull MethodReferencesSearch.SearchParameters p, @NotNull Processor<PsiReference> consumer) {
|
||||
public void processQuery(@NotNull MethodReferencesSearch.SearchParameters p, @NotNull Processor<? super PsiReference> consumer) {
|
||||
processConstructorUsages(p.getMethod(), p.getEffectiveSearchScope(), consumer, p.getOptimizer(), !p.isStrictSignatureSearch());
|
||||
}
|
||||
|
||||
public static final Key<Set<PsiClass>> LITERALLY_CONSTRUCTED_CLASSES = Key.create("LITERALLY_CONSTRUCTED_CLASSES");
|
||||
static void processConstructorUsages(final PsiMethod constructor,
|
||||
final SearchScope searchScope,
|
||||
final Processor<PsiReference> consumer,
|
||||
final Processor<? super PsiReference> consumer,
|
||||
final SearchRequestCollector collector,
|
||||
final boolean includeOverloads) {
|
||||
if (!constructor.isConstructor()) return;
|
||||
@@ -210,7 +196,7 @@ public class GroovyConstructorUsagesSearcher extends QueryExecutorBase<PsiRefere
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean processConstructors(final PsiMethod searchedConstructor, final Processor<PsiReference> consumer, final PsiClass clazz,
|
||||
private static boolean processConstructors(final PsiMethod searchedConstructor, final Processor<? super PsiReference> consumer, final PsiClass clazz,
|
||||
final boolean processThisRefs) {
|
||||
final PsiMethod[] constructors = clazz.getConstructors();
|
||||
if (constructors.length == 0) {
|
||||
@@ -238,7 +224,7 @@ public class GroovyConstructorUsagesSearcher extends QueryExecutorBase<PsiRefere
|
||||
}
|
||||
|
||||
private static void processImplicitConstructorCall(@NotNull final PsiMember usage,
|
||||
final Processor<PsiReference> processor,
|
||||
final Processor<? super PsiReference> processor,
|
||||
final PsiMethod constructor) {
|
||||
if (constructor instanceof GrMethod) {
|
||||
GrParameter[] grParameters = (GrParameter[])constructor.getParameterList().getParameters();
|
||||
|
||||
+2
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package org.jetbrains.plugins.groovy.findUsages;
|
||||
|
||||
import com.intellij.codeInsight.navigation.MethodImplementationsSearch;
|
||||
@@ -34,7 +20,7 @@ import org.jetbrains.plugins.groovy.lang.psi.util.GroovyPropertyUtils;
|
||||
*/
|
||||
public class GroovyImplementationSearch implements QueryExecutor<PsiElement, DefinitionsScopedSearch.SearchParameters> {
|
||||
@Override
|
||||
public boolean execute(@NotNull final DefinitionsScopedSearch.SearchParameters queryParameters, @NotNull final Processor<PsiElement> consumer) {
|
||||
public boolean execute(@NotNull final DefinitionsScopedSearch.SearchParameters queryParameters, @NotNull final Processor<? super PsiElement> consumer) {
|
||||
return ReadAction.compute(() -> {
|
||||
final PsiElement source = queryParameters.getElement();
|
||||
if (!source.isValid()) return true;
|
||||
|
||||
+2
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package org.jetbrains.plugins.groovy.findUsages;
|
||||
|
||||
import com.intellij.openapi.application.QueryExecutorBase;
|
||||
@@ -33,7 +19,7 @@ public class GroovyReflectedMethodReferenceSearcher extends QueryExecutorBase<Ps
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processQuery(@NotNull MethodReferencesSearch.SearchParameters queryParameters, @NotNull Processor<PsiReference> consumer) {
|
||||
public void processQuery(@NotNull MethodReferencesSearch.SearchParameters queryParameters, @NotNull Processor<? super PsiReference> consumer) {
|
||||
final PsiMethod method = queryParameters.getMethod();
|
||||
if (method instanceof GrMethod) {
|
||||
for (GrReflectedMethod reflectedMethod : ((GrMethod)method).getReflectedMethods()) {
|
||||
|
||||
+3
-17
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package org.jetbrains.plugins.groovy.findUsages;
|
||||
|
||||
import com.intellij.openapi.application.QueryExecutorBase;
|
||||
@@ -33,7 +19,7 @@ public class GroovyTraitFieldSearcher extends QueryExecutorBase<PsiReference, Re
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processQuery(@NotNull ReferencesSearch.SearchParameters p, @NotNull Processor<PsiReference> consumer) {
|
||||
public void processQuery(@NotNull ReferencesSearch.SearchParameters p, @NotNull Processor<? super PsiReference> consumer) {
|
||||
final PsiElement target = p.getElementToSearch();
|
||||
|
||||
if (target instanceof GrField && !(target instanceof GrTraitField)) {
|
||||
@@ -58,7 +44,7 @@ public class GroovyTraitFieldSearcher extends QueryExecutorBase<PsiReference, Re
|
||||
@Override
|
||||
public boolean processTextOccurrence(@NotNull PsiElement element,
|
||||
int offsetInElement,
|
||||
@NotNull Processor<PsiReference> consumer) {
|
||||
@NotNull Processor<? super PsiReference> consumer) {
|
||||
PsiElement parent = element.getParent();
|
||||
if (parent instanceof GrReferenceExpression && element == ((GrReferenceExpression)parent).getReferenceNameElement()) {
|
||||
PsiElement resolved = ((GrReferenceExpression)parent).resolve();
|
||||
|
||||
+3
-17
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package org.jetbrains.plugins.groovy.findUsages;
|
||||
|
||||
import com.intellij.psi.PsiClass;
|
||||
@@ -27,10 +13,10 @@ import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.GrListOrMap;
|
||||
*/
|
||||
public class LiteralConstructorSearcher {
|
||||
private final PsiMethod myConstructor;
|
||||
private final Processor<PsiReference> myConsumer;
|
||||
private final Processor<? super PsiReference> myConsumer;
|
||||
private final boolean myIncludeOverloads;
|
||||
|
||||
public LiteralConstructorSearcher(PsiMethod constructor, Processor<PsiReference> consumer, boolean includeOverloads) {
|
||||
public LiteralConstructorSearcher(PsiMethod constructor, Processor<? super PsiReference> consumer, boolean includeOverloads) {
|
||||
myConstructor = constructor;
|
||||
myConsumer = consumer;
|
||||
myIncludeOverloads = includeOverloads;
|
||||
|
||||
+3
-18
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
|
||||
package org.jetbrains.plugins.groovy.findUsages;
|
||||
|
||||
@@ -27,7 +13,6 @@ import com.intellij.psi.PsiMethod;
|
||||
import com.intellij.psi.PsiReference;
|
||||
import com.intellij.psi.search.*;
|
||||
import com.intellij.psi.search.searches.MethodReferencesSearch;
|
||||
import com.intellij.psi.util.PropertyUtil;
|
||||
import com.intellij.psi.util.PropertyUtilBase;
|
||||
import com.intellij.util.Processor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -50,7 +35,7 @@ public class MethodLateBoundReferencesSearcher extends QueryExecutorBase<PsiRefe
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processQuery(@NotNull MethodReferencesSearch.SearchParameters queryParameters, @NotNull Processor<PsiReference> consumer) {
|
||||
public void processQuery(@NotNull MethodReferencesSearch.SearchParameters queryParameters, @NotNull Processor<? super PsiReference> consumer) {
|
||||
final PsiMethod method = queryParameters.getMethod();
|
||||
SearchScope searchScope = GroovyScopeUtil.restrictScopeToGroovyFiles(queryParameters.getEffectiveSearchScope()).intersectWith(
|
||||
getUseScope(method));
|
||||
@@ -84,7 +69,7 @@ public class MethodLateBoundReferencesSearcher extends QueryExecutorBase<PsiRefe
|
||||
if (StringUtil.isEmpty(name)) return;
|
||||
collector.searchWord(name, searchScope, UsageSearchContext.IN_CODE, true, searchTarget, new RequestResultProcessor("groovy.lateBound") {
|
||||
@Override
|
||||
public boolean processTextOccurrence(@NotNull PsiElement element, int offsetInElement, @NotNull Processor<PsiReference> consumer) {
|
||||
public boolean processTextOccurrence(@NotNull PsiElement element, int offsetInElement, @NotNull Processor<? super PsiReference> consumer) {
|
||||
if (!(element instanceof GrReferenceExpression)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ import org.jetbrains.plugins.groovy.lang.psi.util.GroovyPropertyUtils
|
||||
*/
|
||||
class PropertyMethodReferenceSearchExecutor : QueryExecutorBase<PsiReference, MethodReferencesSearch.SearchParameters>(true) {
|
||||
|
||||
override fun processQuery(queryParameters: MethodReferencesSearch.SearchParameters, consumer: Processor<PsiReference>) {
|
||||
override fun processQuery(queryParameters: MethodReferencesSearch.SearchParameters, consumer: Processor<in PsiReference>) {
|
||||
val method = queryParameters.method
|
||||
|
||||
val propertyName: String? = if (GdkMethodUtil.isCategoryMethod(method, null, null, PsiSubstitutor.EMPTY)) {
|
||||
|
||||
+2
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package org.jetbrains.plugins.groovy.lang.psi.impl;
|
||||
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
@@ -68,7 +54,7 @@ public class GroovyDirectInheritorsSearcher implements QueryExecutor<PsiClass, D
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(@NotNull final DirectClassInheritorsSearch.SearchParameters queryParameters, @NotNull final Processor<PsiClass> consumer) {
|
||||
public boolean execute(@NotNull final DirectClassInheritorsSearch.SearchParameters queryParameters, @NotNull final Processor<? super PsiClass> consumer) {
|
||||
final PsiClass clazz = queryParameters.getClassToProcess();
|
||||
final SearchScope scope = queryParameters.getScope();
|
||||
Project project = PsiUtilCore.getProjectInReadAction(clazz);
|
||||
|
||||
+2
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package org.jetbrains.plugins.groovy.transformations.indexedProperty
|
||||
|
||||
import com.intellij.openapi.application.runReadAction
|
||||
@@ -25,7 +11,7 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrField
|
||||
|
||||
class IndexedPropertyReferenceSearchExecutor : QueryExecutor<PsiReference, ReferencesSearch.SearchParameters> {
|
||||
|
||||
override fun execute(queryParameters: ReferencesSearch.SearchParameters, consumer: Processor<PsiReference>): Boolean {
|
||||
override fun execute(queryParameters: ReferencesSearch.SearchParameters, consumer: Processor<in PsiReference>): Boolean {
|
||||
val field = queryParameters.elementToSearch
|
||||
if (field is GrField) {
|
||||
runReadAction {
|
||||
|
||||
+2
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package org.jetbrains.plugins.javaFX.fxml.refs;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
@@ -35,7 +21,7 @@ import java.util.List;
|
||||
|
||||
public class JavaFxControllerFieldSearcher implements QueryExecutor<PsiReference, ReferencesSearch.SearchParameters>{
|
||||
@Override
|
||||
public boolean execute(@NotNull final ReferencesSearch.SearchParameters queryParameters, @NotNull final Processor<PsiReference> consumer) {
|
||||
public boolean execute(@NotNull final ReferencesSearch.SearchParameters queryParameters, @NotNull final Processor<? super PsiReference> consumer) {
|
||||
final PsiElement elementToSearch = queryParameters.getElementToSearch();
|
||||
if (elementToSearch instanceof PsiField) {
|
||||
final PsiField field = (PsiField)elementToSearch;
|
||||
|
||||
+4
-18
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package org.jetbrains.plugins.javaFX.fxml.refs;
|
||||
|
||||
import com.intellij.openapi.application.ReadAction;
|
||||
@@ -44,7 +30,7 @@ import org.jetbrains.plugins.javaFX.refactoring.JavaFxPropertyElement;
|
||||
public class JavaFxMethodSearcher implements QueryExecutor<PsiReference, ReferencesSearch.SearchParameters> {
|
||||
@Override
|
||||
public boolean execute(@NotNull final ReferencesSearch.SearchParameters queryParameters,
|
||||
@NotNull final Processor<PsiReference> consumer) {
|
||||
@NotNull final Processor<? super PsiReference> consumer) {
|
||||
final PsiElement elementToSearch = queryParameters.getElementToSearch();
|
||||
if (elementToSearch instanceof PsiMethod) {
|
||||
searchMethod((PsiMethod)elementToSearch, queryParameters, consumer);
|
||||
@@ -61,7 +47,7 @@ public class JavaFxMethodSearcher implements QueryExecutor<PsiReference, Referen
|
||||
}
|
||||
|
||||
private static void searchMethod(@NotNull PsiMethod psiMethod, @NotNull ReferencesSearch.SearchParameters queryParameters,
|
||||
@NotNull Processor<PsiReference> consumer) {
|
||||
@NotNull Processor<? super PsiReference> consumer) {
|
||||
final Project project = PsiUtilCore.getProjectInReadAction(psiMethod);
|
||||
final SearchScope scope =
|
||||
ReadAction.compute(queryParameters::getEffectiveSearchScope);
|
||||
@@ -100,7 +86,7 @@ public class JavaFxMethodSearcher implements QueryExecutor<PsiReference, Referen
|
||||
|
||||
private static boolean searchMethodInFile(@NotNull PsiMethod psiMethod,
|
||||
@NotNull PsiFile file,
|
||||
@NotNull Processor<PsiReference> consumer) {
|
||||
@NotNull Processor<? super PsiReference> consumer) {
|
||||
final Ref<Boolean> stopped = new Ref<>(false);
|
||||
file.accept(new XmlRecursiveElementVisitor() {
|
||||
@Override
|
||||
|
||||
+2
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package com.intellij.lang.properties.editor;
|
||||
|
||||
import com.intellij.lang.properties.IProperty;
|
||||
@@ -40,7 +26,7 @@ public class PropertiesInheritorsSearcher extends QueryExecutorBase<PsiElement,
|
||||
private static final Logger LOG = Logger.getInstance(PropertiesInheritorsSearcher.class);
|
||||
|
||||
@Override
|
||||
public void processQuery(@NotNull DefinitionsScopedSearch.SearchParameters queryParameters, @NotNull Processor<PsiElement> consumer) {
|
||||
public void processQuery(@NotNull DefinitionsScopedSearch.SearchParameters queryParameters, @NotNull Processor<? super PsiElement> consumer) {
|
||||
final PsiElement element = queryParameters.getElement();
|
||||
Property prop = ReadAction.compute(() -> GotoPropertyParentDeclarationHandler.findProperty(element));
|
||||
if (prop == null || !(queryParameters.getScope() instanceof GlobalSearchScope)) {
|
||||
|
||||
@@ -1,24 +1,13 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package com.theoryinpractice.testng;
|
||||
|
||||
import com.intellij.codeInsight.AnnotationUtil;
|
||||
import com.intellij.openapi.application.QueryExecutorBase;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.PsiAnnotation;
|
||||
import com.intellij.psi.PsiAnnotationMemberValue;
|
||||
import com.intellij.psi.PsiMethod;
|
||||
import com.intellij.psi.PsiReference;
|
||||
import com.intellij.psi.search.UsageSearchContext;
|
||||
import com.intellij.psi.search.searches.MethodReferencesSearch;
|
||||
import com.intellij.util.Processor;
|
||||
@@ -31,7 +20,7 @@ public class DataProviderSearcher extends QueryExecutorBase<PsiReference, Method
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processQuery(@NotNull MethodReferencesSearch.SearchParameters queryParameters, @NotNull Processor<PsiReference> consumer) {
|
||||
public void processQuery(@NotNull MethodReferencesSearch.SearchParameters queryParameters, @NotNull Processor<? super PsiReference> consumer) {
|
||||
final PsiMethod method = queryParameters.getMethod();
|
||||
|
||||
final PsiAnnotation annotation = AnnotationUtil.findAnnotation(method, DataProvider.class.getName());
|
||||
|
||||
@@ -33,7 +33,7 @@ import java.util.List;
|
||||
*/
|
||||
public class FormReferencesSearcher implements QueryExecutor<PsiReference, ReferencesSearch.SearchParameters> {
|
||||
@Override
|
||||
public boolean execute(@NotNull final ReferencesSearch.SearchParameters p, @NotNull final Processor<PsiReference> consumer) {
|
||||
public boolean execute(@NotNull final ReferencesSearch.SearchParameters p, @NotNull final Processor<? super PsiReference> consumer) {
|
||||
SearchScope userScope = p.getScopeDeterminedByUser();
|
||||
if (!scopeCanContainForms(userScope)) return true;
|
||||
final PsiElement refElement = p.getElementToSearch();
|
||||
@@ -104,7 +104,7 @@ public class FormReferencesSearcher implements QueryExecutor<PsiReference, Refer
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean processReferencesInUIForms(Processor<PsiReference> processor,
|
||||
private static boolean processReferencesInUIForms(Processor<? super PsiReference> processor,
|
||||
PsiManager psiManager, final PsiClass aClass,
|
||||
GlobalSearchScope scope, final LocalSearchScope filterScope) {
|
||||
String className = getQualifiedName(aClass);
|
||||
@@ -118,7 +118,7 @@ public class FormReferencesSearcher implements QueryExecutor<PsiReference, Refer
|
||||
});
|
||||
}
|
||||
|
||||
private static boolean processEnumReferencesInUIForms(Processor<PsiReference> processor,
|
||||
private static boolean processEnumReferencesInUIForms(Processor<? super PsiReference> processor,
|
||||
PsiManager psiManager, final PsiEnumConstant enumConstant,
|
||||
GlobalSearchScope scope, final LocalSearchScope filterScope) {
|
||||
String className = ReadAction.compute(() -> enumConstant.getName());
|
||||
@@ -127,7 +127,7 @@ public class FormReferencesSearcher implements QueryExecutor<PsiReference, Refer
|
||||
|
||||
private static boolean processReferencesInUIFormsInner(String name,
|
||||
PsiElement element,
|
||||
Processor<PsiReference> processor,
|
||||
Processor<? super PsiReference> processor,
|
||||
GlobalSearchScope scope1,
|
||||
PsiManager manager,
|
||||
final LocalSearchScope filterScope) {
|
||||
@@ -137,7 +137,7 @@ public class FormReferencesSearcher implements QueryExecutor<PsiReference, Refer
|
||||
return processReferencesInFiles(files, manager, name, element, filterScope, processor);
|
||||
}
|
||||
|
||||
private static boolean processReferencesInUIForms(Processor<PsiReference> processor,
|
||||
private static boolean processReferencesInUIForms(Processor<? super PsiReference> processor,
|
||||
PsiManager psiManager,
|
||||
PsiField field,
|
||||
GlobalSearchScope scope1,
|
||||
@@ -150,7 +150,7 @@ public class FormReferencesSearcher implements QueryExecutor<PsiReference, Refer
|
||||
return processReferencesInFiles(files, psiManager, fieldName, field, filterScope, processor);
|
||||
}
|
||||
|
||||
private static boolean processReferences(final Processor<PsiReference> processor,
|
||||
private static boolean processReferences(final Processor<? super PsiReference> processor,
|
||||
final PsiFile file,
|
||||
String name,
|
||||
final PsiElement element,
|
||||
@@ -190,7 +190,7 @@ public class FormReferencesSearcher implements QueryExecutor<PsiReference, Refer
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean processReferencesInUIForms(final Processor<PsiReference> processor,
|
||||
private static boolean processReferencesInUIForms(final Processor<? super PsiReference> processor,
|
||||
PsiManager psiManager,
|
||||
final Property property,
|
||||
final GlobalSearchScope globalSearchScope,
|
||||
@@ -228,7 +228,7 @@ public class FormReferencesSearcher implements QueryExecutor<PsiReference, Refer
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean processReferencesInUIForms(final Processor<PsiReference> processor,
|
||||
private static boolean processReferencesInUIForms(final Processor<? super PsiReference> processor,
|
||||
PsiManager psiManager,
|
||||
final PropertiesFile propFile,
|
||||
final GlobalSearchScope globalSearchScope,
|
||||
@@ -246,7 +246,7 @@ public class FormReferencesSearcher implements QueryExecutor<PsiReference, Refer
|
||||
PsiManager psiManager, String baseName,
|
||||
PsiElement element,
|
||||
LocalSearchScope filterScope,
|
||||
Processor<PsiReference> processor) {
|
||||
Processor<? super PsiReference> processor) {
|
||||
psiManager.startBatchFilesProcessingMode();
|
||||
|
||||
try {
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package org.jetbrains.plugins.ipnb.psi;
|
||||
|
||||
import com.intellij.openapi.application.QueryExecutorBase;
|
||||
@@ -36,7 +22,7 @@ import java.util.List;
|
||||
|
||||
public class IpnbSearchExecutor extends QueryExecutorBase<PsiReference, ReferencesSearch.SearchParameters> {
|
||||
@Override
|
||||
public void processQuery(@NotNull final ReferencesSearch.SearchParameters queryParameters, @NotNull final Processor<PsiReference> consumer) {
|
||||
public void processQuery(@NotNull final ReferencesSearch.SearchParameters queryParameters, @NotNull final Processor<? super PsiReference> consumer) {
|
||||
final SearchScope scope = queryParameters.getEffectiveSearchScope();
|
||||
if (scope instanceof LocalSearchScope) return;
|
||||
final PsiElement element = queryParameters.getElementToSearch();
|
||||
|
||||
+2
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package com.jetbrains.python.psi.impl;
|
||||
|
||||
import com.intellij.psi.PsiClass;
|
||||
@@ -32,7 +18,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
* @author yole
|
||||
*/
|
||||
public class PyJavaSuperMethodsSearchExecutor implements QueryExecutor<PsiElement, PySuperMethodsSearch.SearchParameters> {
|
||||
public boolean execute(@NotNull final PySuperMethodsSearch.SearchParameters queryParameters, @NotNull final Processor<PsiElement> consumer) {
|
||||
public boolean execute(@NotNull final PySuperMethodsSearch.SearchParameters queryParameters, @NotNull final Processor<? super PsiElement> consumer) {
|
||||
PyFunction func = queryParameters.getDerivedMethod();
|
||||
PyClass containingClass = func.getContainingClass();
|
||||
if (containingClass != null) {
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package com.jetbrains.python.magicLiteral;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
@@ -34,7 +20,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
class PyMagicLiteralReferenceSearcher extends QueryExecutorBase<PsiReference, ReferencesSearch.SearchParameters> {
|
||||
|
||||
@Override
|
||||
public void processQuery(@NotNull final ReferencesSearch.SearchParameters queryParameters, @NotNull final Processor<PsiReference> consumer) {
|
||||
public void processQuery(@NotNull final ReferencesSearch.SearchParameters queryParameters, @NotNull final Processor<? super PsiReference> consumer) {
|
||||
ApplicationManager.getApplication().runReadAction(() -> {
|
||||
final PsiElement refElement = queryParameters.getElementToSearch();
|
||||
if (PyMagicLiteralTools.isMagicLiteral(refElement)) {
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package com.jetbrains.python.psi.search;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
@@ -40,13 +26,13 @@ public class PyClassInheritorsSearchExecutor implements QueryExecutor<PyClass, P
|
||||
*/
|
||||
protected static final ImmutableSet<String> IGNORED_BASES = ImmutableSet.of("object", "BaseException", "Exception");
|
||||
|
||||
public boolean execute(@NotNull final PyClassInheritorsSearch.SearchParameters queryParameters, @NotNull final Processor<PyClass> consumer) {
|
||||
public boolean execute(@NotNull final PyClassInheritorsSearch.SearchParameters queryParameters, @NotNull final Processor<? super PyClass> consumer) {
|
||||
Set<PyClass> processed = new HashSet<>();
|
||||
return processDirectInheritors(queryParameters.getSuperClass(), consumer, queryParameters.isCheckDeepInheritance(), processed);
|
||||
}
|
||||
|
||||
private static boolean processDirectInheritors(
|
||||
final PyClass superClass, final Processor<PyClass> consumer, final boolean checkDeep, final Set<PyClass> processed
|
||||
final PyClass superClass, final Processor<? super PyClass> consumer, final boolean checkDeep, final Set<PyClass> processed
|
||||
) {
|
||||
return ReadAction.compute(() -> {
|
||||
final String superClassName = superClass.getName();
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package com.jetbrains.python.psi.search;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
@@ -32,7 +18,7 @@ import com.jetbrains.python.psi.PyUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class PyClassReferenceSearchExecutor extends QueryExecutorBase<PsiReference, ReferencesSearch.SearchParameters> {
|
||||
public void processQuery(@NotNull ReferencesSearch.SearchParameters queryParameters, @NotNull final Processor<PsiReference> consumer) {
|
||||
public void processQuery(@NotNull ReferencesSearch.SearchParameters queryParameters, @NotNull final Processor<? super PsiReference> consumer) {
|
||||
PyClass pyClass = PyUtil.as(queryParameters.getElementToSearch(), PyClass.class);
|
||||
if (pyClass == null) {
|
||||
return;
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package com.jetbrains.python.psi.search;
|
||||
|
||||
import com.intellij.openapi.application.ReadAction;
|
||||
@@ -30,7 +16,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
* @author yole
|
||||
*/
|
||||
public class PyDefinitionsSearch implements QueryExecutor<PsiElement, PsiElement> {
|
||||
public boolean execute(@NotNull final PsiElement queryParameters, @NotNull final Processor<PsiElement> consumer) {
|
||||
public boolean execute(@NotNull final PsiElement queryParameters, @NotNull final Processor<? super PsiElement> consumer) {
|
||||
if (queryParameters instanceof PyClass) {
|
||||
final Query<PyClass> query = PyClassInheritorsSearch.search((PyClass)queryParameters, true);
|
||||
return query.forEach(pyClass -> {
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package com.jetbrains.python.psi.search;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
@@ -34,7 +20,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
* @author yole
|
||||
*/
|
||||
public class PyInitReferenceSearchExecutor extends QueryExecutorBase<PsiReference, ReferencesSearch.SearchParameters> {
|
||||
public void processQuery(@NotNull ReferencesSearch.SearchParameters queryParameters, @NotNull final Processor<PsiReference> consumer) {
|
||||
public void processQuery(@NotNull ReferencesSearch.SearchParameters queryParameters, @NotNull final Processor<? super PsiReference> consumer) {
|
||||
PsiElement element = queryParameters.getElementToSearch();
|
||||
if (!(element instanceof PyFunction)) {
|
||||
return;
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package com.jetbrains.python.psi.search;
|
||||
|
||||
import com.intellij.openapi.application.QueryExecutorBase;
|
||||
@@ -32,7 +18,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
public class PyKeywordArgumentSearchExecutor extends QueryExecutorBase<PsiReference, ReferencesSearch.SearchParameters> {
|
||||
@Override
|
||||
public void processQuery(@NotNull final ReferencesSearch.SearchParameters queryParameters, @NotNull final Processor<PsiReference> consumer) {
|
||||
public void processQuery(@NotNull final ReferencesSearch.SearchParameters queryParameters, @NotNull final Processor<? super PsiReference> consumer) {
|
||||
final PsiElement element = queryParameters.getElementToSearch();
|
||||
if (!(element instanceof PyNamedParameter)) {
|
||||
return;
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package com.jetbrains.python.psi.search;
|
||||
|
||||
import com.intellij.openapi.application.ReadAction;
|
||||
@@ -26,7 +12,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
public class PyOverridingMethodsSearchExecutor implements QueryExecutor<PyFunction, PyOverridingMethodsSearch.SearchParameters> {
|
||||
public boolean execute(@NotNull final PyOverridingMethodsSearch.SearchParameters queryParameters,
|
||||
@NotNull final Processor<PyFunction> consumer) {
|
||||
@NotNull final Processor<? super PyFunction> consumer) {
|
||||
final PyFunction baseMethod = queryParameters.getFunction();
|
||||
|
||||
final PyClass containingClass = ReadAction.compute(() -> baseMethod.getContainingClass());
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package com.jetbrains.python.psi.search;
|
||||
|
||||
import com.intellij.openapi.application.QueryExecutorBase;
|
||||
@@ -40,7 +26,7 @@ public class PyStringReferenceSearch extends QueryExecutorBase<PsiReference, Ref
|
||||
}
|
||||
|
||||
public void processQuery(@NotNull final ReferencesSearch.SearchParameters params,
|
||||
@NotNull final Processor<PsiReference> consumer) {
|
||||
@NotNull final Processor<? super PsiReference> consumer) {
|
||||
final PsiElement element = params.getElementToSearch();
|
||||
if (!(element instanceof PyElement) && !(element instanceof PsiDirectory)) {
|
||||
return;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2017 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.
|
||||
// Copyright 2000-2018 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.
|
||||
package com.jetbrains.python.psi.search;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
@@ -14,7 +14,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
public class PySuperMethodsSearchExecutor implements QueryExecutor<PsiElement, PySuperMethodsSearch.SearchParameters> {
|
||||
@Override
|
||||
public boolean execute(@NotNull final PySuperMethodsSearch.SearchParameters queryParameters,
|
||||
@NotNull final Processor<PsiElement> consumer) {
|
||||
@NotNull final Processor<? super PsiElement> consumer) {
|
||||
final PyFunction func = queryParameters.getDerivedMethod();
|
||||
final String name = func.getName();
|
||||
final PyClass containingClass = func.getContainingClass();
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 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.
|
||||
package com.intellij.xml.impl.schema;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
@@ -44,7 +30,7 @@ import java.util.function.BiFunction;
|
||||
|
||||
public class SchemaDefinitionsSearch implements QueryExecutor<PsiElement, PsiElement> {
|
||||
@Override
|
||||
public boolean execute(@NotNull final PsiElement queryParameters, @NotNull final Processor<PsiElement> consumer) {
|
||||
public boolean execute(@NotNull final PsiElement queryParameters, @NotNull final Processor<? super PsiElement> consumer) {
|
||||
if (queryParameters instanceof XmlTagImpl) {
|
||||
final XmlTagImpl xml = (XmlTagImpl) queryParameters;
|
||||
if (ReadAction.compute(() -> isTypeElement(xml))) {
|
||||
|
||||
Reference in New Issue
Block a user