mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
annotation highlighting: skip unresolved attribute highlighting for non-annotation types
GitOrigin-RevId: 4b705957a414cc90f2b952595f6d6dfbb880f876
This commit is contained in:
committed by
intellij-monorepo-bot
parent
893413de5a
commit
5d96e5d9f0
+6
@@ -47,6 +47,12 @@ public class AnnotationsHighlightUtil {
|
||||
@Nullable
|
||||
static HighlightInfo checkNameValuePair(@NotNull PsiNameValuePair pair,
|
||||
RefCountHolder refCountHolder) {
|
||||
PsiAnnotation annotation = PsiTreeUtil.getParentOfType(pair, PsiAnnotation.class);
|
||||
if (annotation == null) return null;
|
||||
PsiJavaCodeReferenceElement annotationNameReferenceElement = annotation.getNameReferenceElement();
|
||||
if (annotationNameReferenceElement == null) return null;
|
||||
PsiElement annotationClass = annotationNameReferenceElement.resolve();
|
||||
if (!(annotationClass instanceof PsiClass && ((PsiClass)annotationClass).isAnnotationType())) return null;
|
||||
PsiReference ref = pair.getReference();
|
||||
if (ref == null) return null;
|
||||
PsiMethod method = (PsiMethod)ref.resolve();
|
||||
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
class Foo<T> {
|
||||
@<error descr="Annotation type expected">T</error>(value =2) void foo() {}
|
||||
}
|
||||
+1
@@ -32,6 +32,7 @@ public class AnnotationsHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testIncompatibleType3() { doTest(); }
|
||||
public void testIncompatibleType4() { doTest(); }
|
||||
public void testIncompatibleType5() { doTest(); }
|
||||
public void testIncompatibleWithUnresolvedAttribute() { doTest(); }
|
||||
public void testMissingAttribute() { doTest(); }
|
||||
public void testDuplicateAnnotation() { setLanguageLevel(LanguageLevel.JDK_1_7); doTest(); }
|
||||
public void testNonConstantInitializer() { doTest(); }
|
||||
|
||||
Reference in New Issue
Block a user