mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-01 06:51:17 +07:00
[java-injection] Support annotations on methods returning template processor (IDEA-333006)
GitOrigin-RevId: e08169d48cbd23db8cfaf2ee4466037bb70a2219
This commit is contained in:
committed by
intellij-monorepo-bot
parent
877c44411b
commit
ac4072eda4
+7
-4
@@ -256,16 +256,19 @@ class JavaLanguageInjectionSupportTest : AbstractLanguageInjectionTestCase() {
|
||||
|
||||
class Hello {
|
||||
void test(@Subst("ClassName") String name, String message) {
|
||||
@Language("JAVA")
|
||||
String s = STR.""${'"'}
|
||||
String s = javaProcessor().""${'"'}
|
||||
class \{name} {
|
||||
void main() {
|
||||
System.out.println("\{message}");
|
||||
}
|
||||
}""${'"'};
|
||||
}
|
||||
}
|
||||
""".trimIndent())
|
||||
|
||||
@Language("JAVA")
|
||||
private static StringTemplate.Processor<String, RuntimeException> javaProcessor() {
|
||||
return STR;
|
||||
}
|
||||
}""".trimIndent())
|
||||
myFixture.checkHighlighting()
|
||||
injectionTestFixture.assertInjectedContent("""
|
||||
class ClassName {
|
||||
|
||||
+6
-2
@@ -156,8 +156,12 @@ public final class AnnotationUtilEx {
|
||||
PsiElement target = ref.resolve();
|
||||
if (target instanceof PsiVariable var) {
|
||||
visitor.visitVariable(var);
|
||||
} else if (target instanceof PsiMethod method) {
|
||||
visitor.visitMethodReturnStatement(parent, method);
|
||||
}
|
||||
}
|
||||
else if (templ.getProcessor() instanceof PsiCallExpression call && call != element) {
|
||||
PsiMethod method = call.resolveMethod();
|
||||
if (method != null) {
|
||||
visitor.visitMethodReturnStatement(call, method);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user