mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-20 13:31:28 +07:00
[java-highlighting] IDEA-368498 Errors about incorrect TYPE_USE annotations are not reported by IntelliJ IDEA
GitOrigin-RevId: 05b017fe457e4efaf0685d429bfd6c2e743936cb
This commit is contained in:
committed by
intellij-monorepo-bot
parent
7e3a48e6ad
commit
bca1a631f8
@@ -466,7 +466,7 @@ final class AnnotationChecker {
|
||||
if (applicable == null) {
|
||||
if (targets.length == 1 && targets[0] == PsiAnnotation.TargetType.TYPE_USE) {
|
||||
PsiElement parent = annotation.getParent();
|
||||
if (parent instanceof PsiTypeElement) {
|
||||
if (parent instanceof PsiTypeElement && !(annotation.getOwner() instanceof PsiArrayType)) {
|
||||
PsiElement modifierList =
|
||||
PsiTreeUtil.skipSiblingsBackward(parent, PsiWhiteSpace.class, PsiComment.class, PsiTypeParameterList.class);
|
||||
if (modifierList instanceof PsiModifierList psiModifierList) {
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
class Jaba {
|
||||
public static void accept(String <error descr="'@Ann' not applicable to type use">@Ann</error> [] s) {
|
||||
}
|
||||
public static void accept2(@Ann String[] s) {
|
||||
}
|
||||
public static void accept3(Jaba.<error descr="'@Ann' not applicable to type use">@Ann</error> Inner s) {
|
||||
}
|
||||
public static void accept4(@Ann Jaba.Inner s) {
|
||||
}
|
||||
|
||||
class Inner {}
|
||||
}
|
||||
|
||||
@Target({ElementType.PARAMETER})
|
||||
@interface Ann {
|
||||
}
|
||||
@@ -39,6 +39,7 @@ public class AnnotationsHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testAnnotationOverIncompleteCode() { doTest(); }
|
||||
public void testDeclarations() { doTest(); }
|
||||
public void testErrorRecovery() { doTest(); }
|
||||
public void testWrongTargetTypeUse() { doTest(); }
|
||||
|
||||
private void doTest() { doTest(getTestName(true) + ".java"); }
|
||||
private void doTest(String name) { doTest(BASE_PATH + "/" + name, false, false); }
|
||||
|
||||
Reference in New Issue
Block a user