From 5247e5b2d70447f020acb999d32d0f0f09bbc288 Mon Sep 17 00:00:00 2001 From: peter Date: Tue, 6 Sep 2016 10:25:14 +0200 Subject: [PATCH] InjectionCache: use allScope to find Language annotation --- .../intelliLang/inject/java/InjectionCache.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/plugins/IntelliLang/java-support/org/intellij/plugins/intelliLang/inject/java/InjectionCache.java b/plugins/IntelliLang/java-support/org/intellij/plugins/intelliLang/inject/java/InjectionCache.java index e1c5213840a0..b11c94181e1d 100644 --- a/plugins/IntelliLang/java-support/org/intellij/plugins/intelliLang/inject/java/InjectionCache.java +++ b/plugins/IntelliLang/java-support/org/intellij/plugins/intelliLang/inject/java/InjectionCache.java @@ -35,7 +35,10 @@ import org.intellij.plugins.intelliLang.inject.config.BaseInjection; import org.intellij.plugins.intelliLang.inject.config.InjectionPlace; import org.jetbrains.annotations.NotNull; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Map; +import java.util.Set; /** * Created by Max Medvedev on 22/03/14 @@ -70,13 +73,13 @@ public class InjectionCache { private Set collectMethodNamesWithLanguage(String annotationClassName) { GlobalSearchScope allScope = GlobalSearchScope.allScope(myProject); - // todo remove once Kotlin support becomes fast enough (https://youtrack.jetbrains.com/issue/KT-13734) - allScope = GlobalSearchScope.getScopeRestrictedByFileTypes(allScope, JavaFileType.INSTANCE); + // todo use allScope once Kotlin support becomes fast enough (https://youtrack.jetbrains.com/issue/KT-13734) + GlobalSearchScope usageScope = GlobalSearchScope.getScopeRestrictedByFileTypes(allScope, JavaFileType.INSTANCE); Set result = new THashSet<>(); ArrayList annoClasses = ContainerUtil.newArrayList(JavaPsiFacade.getInstance(myProject).findClasses(annotationClassName, allScope)); for (int cursor = 0; cursor < annoClasses.size(); cursor++) { - AnnotatedElementsSearch.searchElements(annoClasses.get(cursor), allScope, PsiClass.class, PsiParameter.class, PsiMethod.class).forEach(element -> { + AnnotatedElementsSearch.searchElements(annoClasses.get(cursor), usageScope, PsiClass.class, PsiParameter.class, PsiMethod.class).forEach(element -> { if (element instanceof PsiParameter) { final PsiElement scope = ((PsiParameter)element).getDeclarationScope(); if (scope instanceof PsiMethod) {