mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-07 22:09:38 +07:00
cleanup
GitOrigin-RevId: 6fa4f979e0a6641885e2225eb985b13713373ac5
This commit is contained in:
committed by
intellij-monorepo-bot
parent
e82d6f4b86
commit
051ed2529b
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 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-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.java.indexing;
|
||||
|
||||
import com.intellij.DynamicBundle;
|
||||
@@ -10,19 +10,17 @@ import org.jetbrains.annotations.PropertyKey;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public final class JavaIndexingBundle {
|
||||
@NonNls private static final String BUNDLE = "messages.JavaIndexingBundle";
|
||||
private static final @NonNls String BUNDLE = "messages.JavaIndexingBundle";
|
||||
private static final DynamicBundle INSTANCE = new DynamicBundle(JavaIndexingBundle.class, BUNDLE);
|
||||
|
||||
private JavaIndexingBundle() {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
|
||||
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
|
||||
return INSTANCE.getMessage(key, params);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
|
||||
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
|
||||
return INSTANCE.getLazyMessage(key, params);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.psi.search;
|
||||
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
@@ -27,13 +27,12 @@ public abstract class JavaStaticMethodNameCache {
|
||||
* @return true if all methods were successfully processed (processor return true for all methods), false otherwise
|
||||
*/
|
||||
public abstract boolean processMethodsWithName(@NotNull Predicate<String> namePredicate,
|
||||
@NotNull final Processor<? super PsiMethod> processor,
|
||||
final @NotNull Processor<? super PsiMethod> processor,
|
||||
@NotNull GlobalSearchScope scope,
|
||||
@Nullable IdFilter filter);
|
||||
|
||||
/**
|
||||
* @return the subclass of PsiShortNamesCache that can be replaced by current class for static methods.
|
||||
*/
|
||||
@NotNull
|
||||
public abstract Class<? extends PsiShortNamesCache> replaced();
|
||||
public abstract @NotNull Class<? extends PsiShortNamesCache> replaced();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2021 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-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.psi.search;
|
||||
|
||||
import com.intellij.lang.Language;
|
||||
@@ -97,7 +97,7 @@ public abstract class PsiShortNamesCache {
|
||||
@NotNull Processor<? super PsiMethod> processor);
|
||||
|
||||
public boolean processMethodsWithName(@NonNls @NotNull String name,
|
||||
@NotNull final Processor<? super PsiMethod> processor,
|
||||
final @NotNull Processor<? super PsiMethod> processor,
|
||||
@NotNull GlobalSearchScope scope,
|
||||
@Nullable IdFilter filter) {
|
||||
return processMethodsWithName(name, scope, processor);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 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-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.psi.search.searches;
|
||||
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
@@ -34,13 +34,11 @@ public final class AllClassesSearch extends ExtensibleQueryFactory<PsiClass, All
|
||||
myShortNameCondition = shortNameCondition;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public SearchScope getScope() {
|
||||
public @NotNull SearchScope getScope() {
|
||||
return myScope;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Project getProject() {
|
||||
public @NotNull Project getProject() {
|
||||
return myProject;
|
||||
}
|
||||
|
||||
@@ -49,13 +47,11 @@ public final class AllClassesSearch extends ExtensibleQueryFactory<PsiClass, All
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Query<PsiClass> search(@NotNull SearchScope scope, @NotNull Project project) {
|
||||
public static @NotNull Query<PsiClass> search(@NotNull SearchScope scope, @NotNull Project project) {
|
||||
return INSTANCE.createQuery(new SearchParameters(scope, project));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Query<PsiClass> search(@NotNull SearchScope scope, @NotNull Project project, @NotNull Condition<? super String> shortNameCondition) {
|
||||
public static @NotNull Query<PsiClass> search(@NotNull SearchScope scope, @NotNull Project project, @NotNull Condition<? super String> shortNameCondition) {
|
||||
return INSTANCE.createQuery(new SearchParameters(scope, project, shortNameCondition));
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 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-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package com.intellij.psi.search.searches;
|
||||
|
||||
@@ -24,21 +24,19 @@ public final class AllOverridingMethodsSearch extends ExtensibleQueryFactory<Pai
|
||||
public static final AllOverridingMethodsSearch INSTANCE = new AllOverridingMethodsSearch();
|
||||
|
||||
public static class SearchParameters {
|
||||
@NotNull private final PsiClass myClass;
|
||||
@NotNull private final SearchScope myScope;
|
||||
private final @NotNull PsiClass myClass;
|
||||
private final @NotNull SearchScope myScope;
|
||||
|
||||
public SearchParameters(@NotNull PsiClass aClass, @NotNull SearchScope scope) {
|
||||
myClass = aClass;
|
||||
myScope = scope;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public PsiClass getPsiClass() {
|
||||
public @NotNull PsiClass getPsiClass() {
|
||||
return myClass;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public SearchScope getScope() {
|
||||
public @NotNull SearchScope getScope() {
|
||||
return myScope;
|
||||
}
|
||||
}
|
||||
@@ -47,14 +45,12 @@ public final class AllOverridingMethodsSearch extends ExtensibleQueryFactory<Pai
|
||||
super(EP_NAME);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Query<Pair<PsiMethod, PsiMethod>> search(@NotNull PsiClass aClass, @NotNull SearchScope scope) {
|
||||
public static @NotNull Query<Pair<PsiMethod, PsiMethod>> search(@NotNull PsiClass aClass, @NotNull SearchScope scope) {
|
||||
if (aClass.hasModifierProperty(PsiModifier.FINAL)) return EmptyQuery.getEmptyQuery(); // Optimization
|
||||
return INSTANCE.createUniqueResultsQuery(new SearchParameters(aClass, scope));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Query<Pair<PsiMethod, PsiMethod>> search(@NotNull PsiClass aClass) {
|
||||
public static @NotNull Query<Pair<PsiMethod, PsiMethod>> search(@NotNull PsiClass aClass) {
|
||||
return search(aClass, GlobalSearchScope.allScope(PsiUtilCore.getProjectInReadAction(aClass)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 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-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.psi.search.searches;
|
||||
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
@@ -32,18 +32,15 @@ public final class AnnotatedElementsSearch extends ExtensibleQueryFactory<PsiMod
|
||||
myApproximate = approximate;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public PsiClass getAnnotationClass() {
|
||||
public @NotNull PsiClass getAnnotationClass() {
|
||||
return myAnnotationClass;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public SearchScope getScope() {
|
||||
public @NotNull SearchScope getScope() {
|
||||
return myScope;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Class<? extends PsiModifierListOwner> @NotNull [] getTypes() {
|
||||
public @NotNull Class<? extends PsiModifierListOwner> @NotNull [] getTypes() {
|
||||
return myTypes;
|
||||
}
|
||||
|
||||
@@ -60,40 +57,33 @@ public final class AnnotatedElementsSearch extends ExtensibleQueryFactory<PsiMod
|
||||
super(EP_NAME);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@SafeVarargs
|
||||
public static <T extends PsiModifierListOwner> Query<T> searchElements(@NotNull PsiClass annotationClass, @NotNull SearchScope scope, @NotNull Class<? extends T> @NotNull ... types) {
|
||||
public static @NotNull <T extends PsiModifierListOwner> Query<T> searchElements(@NotNull PsiClass annotationClass, @NotNull SearchScope scope, @NotNull Class<? extends T> @NotNull ... types) {
|
||||
//noinspection unchecked
|
||||
return (Query<T>)searchElements(new Parameters(annotationClass, scope, types));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Query<? extends PsiModifierListOwner> searchElements(@NotNull Parameters parameters) {
|
||||
public static @NotNull Query<? extends PsiModifierListOwner> searchElements(@NotNull Parameters parameters) {
|
||||
return new InstanceofQuery<>(INSTANCE.createQuery(parameters), parameters.getTypes());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Query<PsiClass> searchPsiClasses(@NotNull PsiClass annotationClass, @NotNull SearchScope scope) {
|
||||
public static @NotNull Query<PsiClass> searchPsiClasses(@NotNull PsiClass annotationClass, @NotNull SearchScope scope) {
|
||||
return searchElements(annotationClass, scope, PsiClass.class);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Query<PsiMethod> searchPsiMethods(@NotNull PsiClass annotationClass, @NotNull SearchScope scope) {
|
||||
public static @NotNull Query<PsiMethod> searchPsiMethods(@NotNull PsiClass annotationClass, @NotNull SearchScope scope) {
|
||||
return searchElements(annotationClass, scope, PsiMethod.class);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Query<PsiMember> searchPsiMembers(@NotNull PsiClass annotationClass, @NotNull SearchScope scope) {
|
||||
public static @NotNull Query<PsiMember> searchPsiMembers(@NotNull PsiClass annotationClass, @NotNull SearchScope scope) {
|
||||
return searchElements(annotationClass, scope, PsiMember.class);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Query<PsiField> searchPsiFields(@NotNull PsiClass annotationClass, @NotNull SearchScope scope) {
|
||||
public static @NotNull Query<PsiField> searchPsiFields(@NotNull PsiClass annotationClass, @NotNull SearchScope scope) {
|
||||
return searchElements(annotationClass, scope, PsiField.class);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Query<PsiParameter> searchPsiParameters(@NotNull PsiClass annotationClass, @NotNull SearchScope scope) {
|
||||
public static @NotNull Query<PsiParameter> searchPsiParameters(@NotNull PsiClass annotationClass, @NotNull SearchScope scope) {
|
||||
return searchElements(annotationClass, scope, PsiParameter.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 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-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.psi.search.searches;
|
||||
|
||||
import com.intellij.psi.PsiClass;
|
||||
@@ -13,13 +13,11 @@ public final class AnnotatedMembersSearch {
|
||||
|
||||
private AnnotatedMembersSearch() {}
|
||||
|
||||
@NotNull
|
||||
public static Query<PsiMember> search(@NotNull PsiClass annotationClass, @NotNull SearchScope scope) {
|
||||
public static @NotNull Query<PsiMember> search(@NotNull PsiClass annotationClass, @NotNull SearchScope scope) {
|
||||
return AnnotatedElementsSearch.searchPsiMembers(annotationClass, scope);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Query<PsiMember> search(@NotNull PsiClass annotationClass) {
|
||||
public static @NotNull Query<PsiMember> search(@NotNull PsiClass annotationClass) {
|
||||
return search(annotationClass, GlobalSearchScope.allScope(PsiUtilCore.getProjectInReadAction(annotationClass)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 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-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.psi.search.searches;
|
||||
|
||||
import com.intellij.psi.PsiClass;
|
||||
@@ -21,26 +21,22 @@ public final class AnnotatedPackagesSearch extends ExtensibleQueryFactory<PsiPac
|
||||
myScope = scope;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public PsiClass getAnnotationClass() {
|
||||
public @NotNull PsiClass getAnnotationClass() {
|
||||
return myAnnotationClass;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public SearchScope getScope() {
|
||||
public @NotNull SearchScope getScope() {
|
||||
return myScope;
|
||||
}
|
||||
}
|
||||
|
||||
private AnnotatedPackagesSearch() {}
|
||||
|
||||
@NotNull
|
||||
public static Query<PsiPackage> search(@NotNull PsiClass annotationClass, @NotNull SearchScope scope) {
|
||||
public static @NotNull Query<PsiPackage> search(@NotNull PsiClass annotationClass, @NotNull SearchScope scope) {
|
||||
return INSTANCE.createQuery(new Parameters(annotationClass, scope));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Query<PsiPackage> search(@NotNull PsiClass annotationClass) {
|
||||
public static @NotNull Query<PsiPackage> search(@NotNull PsiClass annotationClass) {
|
||||
return search(annotationClass, GlobalSearchScope.allScope(PsiUtilCore.getProjectInReadAction(annotationClass)));
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 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-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.psi.search.searches;
|
||||
|
||||
import com.intellij.psi.PsiClass;
|
||||
@@ -24,28 +24,24 @@ public final class AnnotationTargetsSearch {
|
||||
myScope = scope;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public PsiClass getAnnotationClass() {
|
||||
public @NotNull PsiClass getAnnotationClass() {
|
||||
return myAnnotationClass;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public SearchScope getScope() {
|
||||
public @NotNull SearchScope getScope() {
|
||||
return myScope;
|
||||
}
|
||||
}
|
||||
|
||||
private AnnotationTargetsSearch() {}
|
||||
|
||||
@NotNull
|
||||
public static Query<PsiModifierListOwner> search(@NotNull PsiClass annotationClass, @NotNull SearchScope scope) {
|
||||
public static @NotNull Query<PsiModifierListOwner> search(@NotNull PsiClass annotationClass, @NotNull SearchScope scope) {
|
||||
final Query<PsiMember> members = AnnotatedMembersSearch.search(annotationClass, scope);
|
||||
final Query<PsiPackage> packages = AnnotatedPackagesSearch.search(annotationClass, scope);
|
||||
return new MergeQuery<>(members, packages);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Query<PsiModifierListOwner> search(@NotNull PsiClass annotationClass) {
|
||||
public static @NotNull Query<PsiModifierListOwner> search(@NotNull PsiClass annotationClass) {
|
||||
return search(annotationClass, GlobalSearchScope.allScope(PsiUtilCore.getProjectInReadAction(annotationClass)));
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.psi.search.searches;
|
||||
|
||||
import com.intellij.lang.Language;
|
||||
@@ -38,17 +38,13 @@ public final class ClassInheritorsSearch extends ExtensibleQueryFactory<PsiClass
|
||||
public static final ClassInheritorsSearch INSTANCE = new ClassInheritorsSearch();
|
||||
|
||||
public static class SearchParameters implements QueryParameters {
|
||||
@NotNull
|
||||
private final PsiClass myClass;
|
||||
@NotNull
|
||||
private final SearchScope myScope;
|
||||
private final @NotNull PsiClass myClass;
|
||||
private final @NotNull SearchScope myScope;
|
||||
private final boolean myCheckDeep;
|
||||
private final boolean myCheckInheritance;
|
||||
private final boolean myIncludeAnonymous;
|
||||
@NotNull
|
||||
private final Condition<? super String> myNameCondition;
|
||||
@NotNull
|
||||
private final Project myProject;
|
||||
private final @NotNull Condition<? super String> myNameCondition;
|
||||
private final @NotNull Project myProject;
|
||||
|
||||
public SearchParameters(@NotNull PsiClass aClass, @NotNull SearchScope scope, boolean checkDeep, boolean checkInheritance, boolean includeAnonymous) {
|
||||
this(aClass, scope, checkDeep, checkInheritance, includeAnonymous, Conditions.alwaysTrue());
|
||||
@@ -66,14 +62,12 @@ public final class ClassInheritorsSearch extends ExtensibleQueryFactory<PsiClass
|
||||
myProject = PsiUtilCore.getProjectInReadAction(myClass);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public PsiClass getClassToProcess() {
|
||||
public @NotNull PsiClass getClassToProcess() {
|
||||
return myClass;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Project getProject() {
|
||||
public @NotNull Project getProject() {
|
||||
return myProject;
|
||||
}
|
||||
|
||||
@@ -82,8 +76,7 @@ public final class ClassInheritorsSearch extends ExtensibleQueryFactory<PsiClass
|
||||
return myClass.isValid();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Condition<? super String> getNameCondition() {
|
||||
public @NotNull Condition<? super String> getNameCondition() {
|
||||
return myNameCondition;
|
||||
}
|
||||
|
||||
@@ -91,8 +84,7 @@ public final class ClassInheritorsSearch extends ExtensibleQueryFactory<PsiClass
|
||||
return myCheckDeep;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public SearchScope getScope() {
|
||||
public @NotNull SearchScope getScope() {
|
||||
return myScope;
|
||||
}
|
||||
|
||||
@@ -150,17 +142,15 @@ public final class ClassInheritorsSearch extends ExtensibleQueryFactory<PsiClass
|
||||
super(EP_NAME);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Query<PsiClass> search(@NotNull PsiClass aClass,
|
||||
@NotNull SearchScope scope,
|
||||
boolean checkDeep,
|
||||
boolean checkInheritance,
|
||||
boolean includeAnonymous) {
|
||||
public static @NotNull Query<PsiClass> search(@NotNull PsiClass aClass,
|
||||
@NotNull SearchScope scope,
|
||||
boolean checkDeep,
|
||||
boolean checkInheritance,
|
||||
boolean includeAnonymous) {
|
||||
return search(new SearchParameters(aClass, scope, checkDeep, checkInheritance, includeAnonymous));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Query<PsiClass> search(@NotNull SearchParameters parameters) {
|
||||
public static @NotNull Query<PsiClass> search(@NotNull SearchParameters parameters) {
|
||||
if (!parameters.isCheckDeep()) {
|
||||
Query<PsiClass> directQuery = DirectClassInheritorsSearch
|
||||
.search(new DirectClassInheritorsSearch.SearchParameters(parameters.getClassToProcess(), parameters.getScope(),
|
||||
@@ -185,13 +175,11 @@ public final class ClassInheritorsSearch extends ExtensibleQueryFactory<PsiClass
|
||||
ReadAction.compute(() -> SmartPointerManager.getInstance(psiClass.getProject()).createSmartPsiElementPointer(psiClass)));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Query<PsiClass> search(@NotNull PsiClass aClass, @NotNull SearchScope scope, boolean checkDeep) {
|
||||
public static @NotNull Query<PsiClass> search(@NotNull PsiClass aClass, @NotNull SearchScope scope, boolean checkDeep) {
|
||||
return search(aClass, scope, checkDeep, true, true);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Query<PsiClass> search(@NotNull PsiClass aClass, boolean checkDeep) {
|
||||
public static @NotNull Query<PsiClass> search(@NotNull PsiClass aClass, boolean checkDeep) {
|
||||
return search(aClass, ReadAction.compute(() -> {
|
||||
if (!aClass.isValid()) {
|
||||
throw new ProcessCanceledException();
|
||||
@@ -201,8 +189,7 @@ public final class ClassInheritorsSearch extends ExtensibleQueryFactory<PsiClass
|
||||
}), checkDeep);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Query<PsiClass> search(@NotNull PsiClass aClass) {
|
||||
public static @NotNull Query<PsiClass> search(@NotNull PsiClass aClass) {
|
||||
return search(aClass, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2021 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-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.psi.search.searches;
|
||||
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
@@ -28,13 +28,11 @@ public final class ClassesWithAnnotatedMembersSearch extends ExtensibleQueryFact
|
||||
myScope = scope;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public PsiClass getAnnotationClass() {
|
||||
public @NotNull PsiClass getAnnotationClass() {
|
||||
return myAnnotationClass;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public SearchScope getScope() {
|
||||
public @NotNull SearchScope getScope() {
|
||||
return myScope;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.psi.search.searches;
|
||||
|
||||
import com.intellij.lang.Language;
|
||||
@@ -33,8 +33,8 @@ public final class DirectClassInheritorsSearch extends ExtensibleQueryFactory<Ps
|
||||
public static final DirectClassInheritorsSearch INSTANCE = new DirectClassInheritorsSearch();
|
||||
|
||||
public static class SearchParameters {
|
||||
@NotNull private final PsiClass myClass;
|
||||
@NotNull private final SearchScope myScope;
|
||||
private final @NotNull PsiClass myClass;
|
||||
private final @NotNull SearchScope myScope;
|
||||
private final boolean myIncludeAnonymous;
|
||||
private final boolean myCheckInheritance;
|
||||
|
||||
@@ -53,13 +53,11 @@ public final class DirectClassInheritorsSearch extends ExtensibleQueryFactory<Ps
|
||||
this(aClass, scope, true);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public PsiClass getClassToProcess() {
|
||||
public @NotNull PsiClass getClassToProcess() {
|
||||
return myClass;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public SearchScope getScope() {
|
||||
public @NotNull SearchScope getScope() {
|
||||
return myScope;
|
||||
}
|
||||
|
||||
@@ -71,8 +69,7 @@ public final class DirectClassInheritorsSearch extends ExtensibleQueryFactory<Ps
|
||||
return myIncludeAnonymous;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ClassInheritorsSearch.SearchParameters getOriginalParameters() {
|
||||
public @Nullable ClassInheritorsSearch.SearchParameters getOriginalParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -86,23 +83,19 @@ public final class DirectClassInheritorsSearch extends ExtensibleQueryFactory<Ps
|
||||
super(EP_NAME);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Query<PsiClass> search(@NotNull PsiClass aClass) {
|
||||
public static @NotNull Query<PsiClass> search(@NotNull PsiClass aClass) {
|
||||
return search(aClass, GlobalSearchScope.allScope(PsiUtilCore.getProjectInReadAction(aClass)));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Query<PsiClass> search(@NotNull PsiClass aClass, @NotNull SearchScope scope) {
|
||||
public static @NotNull Query<PsiClass> search(@NotNull PsiClass aClass, @NotNull SearchScope scope) {
|
||||
return search(aClass, scope, true);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Query<PsiClass> search(@NotNull PsiClass aClass, @NotNull SearchScope scope, boolean includeAnonymous) {
|
||||
public static @NotNull Query<PsiClass> search(@NotNull PsiClass aClass, @NotNull SearchScope scope, boolean includeAnonymous) {
|
||||
return search(new SearchParameters(aClass, scope, includeAnonymous, true));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Query<PsiClass> search(@NotNull SearchParameters parameters) {
|
||||
public static @NotNull Query<PsiClass> search(@NotNull SearchParameters parameters) {
|
||||
return INSTANCE.createUniqueResultsQuery(parameters);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.psi.search.searches;
|
||||
|
||||
import com.intellij.openapi.application.ReadAction;
|
||||
@@ -36,40 +36,33 @@ public final class FunctionalExpressionSearch extends ExtensibleQueryFactory<Psi
|
||||
myScope = scope;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public PsiMethod getMethod() {
|
||||
public @Nullable PsiMethod getMethod() {
|
||||
return myMethod;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public PsiClass getElementToSearch() {
|
||||
public @NotNull PsiClass getElementToSearch() {
|
||||
return myElementToSearch;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public SearchScope getEffectiveSearchScope () {
|
||||
public @NotNull SearchScope getEffectiveSearchScope () {
|
||||
return myScope.intersectWith(PsiSearchHelper.getInstance(myProject).getUseScope(myElementToSearch));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Project getProject() {
|
||||
public @NotNull Project getProject() {
|
||||
return myProject;
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Query<PsiFunctionalExpression> search(@NotNull PsiClass aClass, @NotNull SearchScope scope) {
|
||||
public static @NotNull Query<PsiFunctionalExpression> search(@NotNull PsiClass aClass, @NotNull SearchScope scope) {
|
||||
SearchParameters parameters = ReadAction.compute(() -> new SearchParameters(aClass, scope));
|
||||
return INSTANCE.createUniqueResultsQuery(parameters, element -> ReadAction.compute(()->SmartPointerManager.getInstance(parameters.myProject).createSmartPsiElementPointer(element)));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Query<PsiFunctionalExpression> search(@NotNull PsiMethod psiMethod) {
|
||||
public static @NotNull Query<PsiFunctionalExpression> search(@NotNull PsiMethod psiMethod) {
|
||||
return search(psiMethod, GlobalSearchScope.allScope(PsiUtilCore.getProjectInReadAction(psiMethod)));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Query<PsiFunctionalExpression> search(@NotNull PsiMethod psiMethod, @NotNull SearchScope scope) {
|
||||
public static @NotNull Query<PsiFunctionalExpression> search(@NotNull PsiMethod psiMethod, @NotNull SearchScope scope) {
|
||||
return ReadAction.compute(() -> {
|
||||
if (psiMethod.hasModifierProperty(PsiModifier.ABSTRACT)) {
|
||||
PsiClass containingClass = psiMethod.getContainingClass();
|
||||
@@ -81,8 +74,7 @@ public final class FunctionalExpressionSearch extends ExtensibleQueryFactory<Psi
|
||||
});
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Query<PsiFunctionalExpression> search(@NotNull PsiClass aClass) {
|
||||
public static @NotNull Query<PsiFunctionalExpression> search(@NotNull PsiClass aClass) {
|
||||
return search(aClass, GlobalSearchScope.allScope(PsiUtilCore.getProjectInReadAction(aClass)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.psi.search.searches;
|
||||
|
||||
import com.intellij.psi.*;
|
||||
@@ -11,21 +11,18 @@ public final class ImplicitToStringSearch extends ExtensibleQueryFactory<PsiExpr
|
||||
|
||||
public static class SearchParameters {
|
||||
private final PsiMethod myTargetMethod;
|
||||
@NotNull
|
||||
private final SearchScope myScope;
|
||||
private final @NotNull SearchScope myScope;
|
||||
|
||||
public SearchParameters(@NotNull PsiMethod targetMethod, @NotNull SearchScope scope) {
|
||||
myTargetMethod = targetMethod;
|
||||
myScope = scope;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public PsiMethod getTargetMethod() {
|
||||
public @NotNull PsiMethod getTargetMethod() {
|
||||
return myTargetMethod;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public SearchScope getSearchScope() {
|
||||
public @NotNull SearchScope getSearchScope() {
|
||||
return myScope;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 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-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.psi.search.searches;
|
||||
|
||||
import com.intellij.openapi.application.DumbAwareSearchParameters;
|
||||
@@ -44,13 +44,11 @@ public final class MethodReferencesSearch extends ExtensibleQueryFactory<PsiRefe
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Project getProject() {
|
||||
public @NotNull Project getProject() {
|
||||
return myProject;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public PsiMethod getMethod() {
|
||||
public @NotNull PsiMethod getMethod() {
|
||||
return myMethod;
|
||||
}
|
||||
|
||||
@@ -71,8 +69,7 @@ public final class MethodReferencesSearch extends ExtensibleQueryFactory<PsiRefe
|
||||
}
|
||||
|
||||
|
||||
@NotNull
|
||||
public SearchScope getEffectiveSearchScope () {
|
||||
public @NotNull SearchScope getEffectiveSearchScope () {
|
||||
SearchScope scope = myEffectiveScope;
|
||||
if (scope == null) {
|
||||
if (!myMethod.isValid()) return LocalSearchScope.EMPTY;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 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-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.psi.search.searches;
|
||||
|
||||
import com.intellij.openapi.application.ReadAction;
|
||||
@@ -16,8 +16,8 @@ public final class OverridingMethodsSearch extends ExtensibleQueryFactory<PsiMet
|
||||
public static final OverridingMethodsSearch INSTANCE = new OverridingMethodsSearch();
|
||||
|
||||
public static class SearchParameters {
|
||||
@NotNull private final PsiMethod myMethod;
|
||||
@NotNull private final SearchScope myScope;
|
||||
private final @NotNull PsiMethod myMethod;
|
||||
private final @NotNull SearchScope myScope;
|
||||
private final boolean myCheckDeep;
|
||||
|
||||
public SearchParameters(@NotNull PsiMethod method, @NotNull SearchScope scope, final boolean checkDeep) {
|
||||
@@ -26,8 +26,7 @@ public final class OverridingMethodsSearch extends ExtensibleQueryFactory<PsiMet
|
||||
myCheckDeep = checkDeep;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public PsiMethod getMethod() {
|
||||
public @NotNull PsiMethod getMethod() {
|
||||
return myMethod;
|
||||
}
|
||||
|
||||
@@ -35,8 +34,7 @@ public final class OverridingMethodsSearch extends ExtensibleQueryFactory<PsiMet
|
||||
return myCheckDeep;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public SearchScope getScope() {
|
||||
public @NotNull SearchScope getScope() {
|
||||
return myScope;
|
||||
}
|
||||
}
|
||||
@@ -49,8 +47,7 @@ public final class OverridingMethodsSearch extends ExtensibleQueryFactory<PsiMet
|
||||
* @param checkDeep false means that processing would be stopped after the first found item
|
||||
* Because search is done in parallel, it can happen that multiple items would be actually found
|
||||
*/
|
||||
@NotNull
|
||||
public static Query<PsiMethod> search(@NotNull PsiMethod method, @NotNull SearchScope scope, final boolean checkDeep) {
|
||||
public static @NotNull Query<PsiMethod> search(@NotNull PsiMethod method, @NotNull SearchScope scope, final boolean checkDeep) {
|
||||
if (ReadAction.compute(() -> !PsiUtil.canBeOverridden(method))) return EmptyQuery.getEmptyQuery(); // Optimization
|
||||
return INSTANCE.createUniqueResultsQuery(new SearchParameters(method, scope, checkDeep));
|
||||
}
|
||||
@@ -60,8 +57,7 @@ public final class OverridingMethodsSearch extends ExtensibleQueryFactory<PsiMet
|
||||
* @param checkDeep if true, indirect overrides will also be returned
|
||||
* @return query containing methods that override the base method
|
||||
*/
|
||||
@NotNull
|
||||
public static Query<PsiMethod> search(@NotNull PsiMethod method, final boolean checkDeep) {
|
||||
public static @NotNull Query<PsiMethod> search(@NotNull PsiMethod method, final boolean checkDeep) {
|
||||
return search(method, ReadAction.compute(method::getUseScope), checkDeep);
|
||||
}
|
||||
|
||||
@@ -69,8 +65,7 @@ public final class OverridingMethodsSearch extends ExtensibleQueryFactory<PsiMet
|
||||
* @param method base method
|
||||
* @return query containing methods that override the base method (directly or indirectly)
|
||||
*/
|
||||
@NotNull
|
||||
public static Query<PsiMethod> search(@NotNull PsiMethod method) {
|
||||
public static @NotNull Query<PsiMethod> search(@NotNull PsiMethod method) {
|
||||
return search(method, true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user