From 3e223423f2b19768ad0b455e5f2a34fb7ad5a024 Mon Sep 17 00:00:00 2001 From: Tagir Valeev Date: Tue, 2 Dec 2025 18:19:51 +0100 Subject: [PATCH] IDEA-303529 [java] LanguageInjection does not work if annotation is in project from dependency Allow search in class files GitOrigin-RevId: be2bdb95629d9361b3fb12ae809cb9cd692d2c67 --- .../plugins/intelliLang/inject/java/InjectionCache.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/java/langInjection/src/org/intellij/plugins/intelliLang/inject/java/InjectionCache.java b/java/langInjection/src/org/intellij/plugins/intelliLang/inject/java/InjectionCache.java index 6c30030ac23a..aae9794638c4 100644 --- a/java/langInjection/src/org/intellij/plugins/intelliLang/inject/java/InjectionCache.java +++ b/java/langInjection/src/org/intellij/plugins/intelliLang/inject/java/InjectionCache.java @@ -1,6 +1,7 @@ // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.intellij.plugins.intelliLang.inject.java; +import com.intellij.ide.highlighter.JavaClassFileType; import com.intellij.ide.highlighter.JavaFileType; import com.intellij.lang.java.JavaLanguage; import com.intellij.openapi.components.Service; @@ -57,7 +58,8 @@ public final class InjectionCache { GlobalSearchScope allScope = GlobalSearchScope.allScope(myProject); // todo use allScope once Kotlin support becomes fast enough (https://youtrack.jetbrains.com/issue/KT-13734) - GlobalSearchScope usageScope = GlobalSearchScope.getScopeRestrictedByFileTypes(allScope, JavaFileType.INSTANCE); + GlobalSearchScope usageScope = GlobalSearchScope.getScopeRestrictedByFileTypes(allScope, JavaFileType.INSTANCE, + JavaClassFileType.INSTANCE); Set result = new HashSet<>(); List annoClasses = new ArrayList<>(List.of(JavaPsiFacade.getInstance(myProject).findClasses(annotationClassName, allScope)));