mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 13:02:30 +07:00
java: fix repeatable annotations check when non-annotation type is passed as value (IDEA-250935)
GitOrigin-RevId: 7f819cfa97ac8fe49e58e3dc2e4c13e42f724963
This commit is contained in:
committed by
intellij-monorepo-bot
parent
c216b02fac
commit
576590686d
@@ -612,7 +612,8 @@ public final class AnnotationsHighlightUtil {
|
||||
PsiClass container = getRepeatableContainer(annotation);
|
||||
if (container == null) return null;
|
||||
|
||||
PsiMethod[] methods = container.findMethodsByName("value", false);
|
||||
PsiMethod[] methods = !container.isAnnotationType() ? PsiMethod.EMPTY_ARRAY
|
||||
: container.findMethodsByName("value", false);
|
||||
if (methods.length == 0) {
|
||||
return JavaErrorBundle.message("annotation.container.no.value", container.getQualifiedName());
|
||||
}
|
||||
@@ -656,7 +657,7 @@ public final class AnnotationsHighlightUtil {
|
||||
PsiType containerType = ((PsiClassObjectAccessExpression)containerRef).getOperand().getType();
|
||||
if (!(containerType instanceof PsiClassType)) return null;
|
||||
PsiClass container = ((PsiClassType)containerType).resolve();
|
||||
if (container == null || !container.isAnnotationType()) return null;
|
||||
if (container == null) return null;
|
||||
return container;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,4 +55,7 @@ class C8 {
|
||||
}
|
||||
|
||||
@interface AA9 { A9[] value(); int i(); }
|
||||
@Repeatable(<error descr="Container annotation 'AA9' does not have a default value for 'i'">AA9.class</error>) @interface A9 { }
|
||||
@Repeatable(<error descr="Container annotation 'AA9' does not have a default value for 'i'">AA9.class</error>) @interface A9 { }
|
||||
|
||||
@Repeatable(<error descr="Invalid container annotation 'java.lang.annotation.Annotation': no 'value' method declared">Annotation.class</error>)
|
||||
@interface A10 {}
|
||||
Reference in New Issue
Block a user