[java] repeatable annotations: check duplicated container annotations (IDEA-274553)

GitOrigin-RevId: 44ddf1c7fd34380627dbbc7c5d9343d7ffdde8a6
This commit is contained in:
Anna Kozlova
2021-07-28 15:08:04 +02:00
committed by intellij-monorepo-bot
parent 4a05392295
commit 2ea4beec8e
2 changed files with 5 additions and 1 deletions

View File

@@ -229,7 +229,7 @@ public final class AnnotationsHighlightUtil {
return annotationError(annotationToCheck, description);
}
}
else if (isAnnotationRepeatedTwice(owner, annotationType.getQualifiedName())) {
if (isAnnotationRepeatedTwice(owner, annotationType.getQualifiedName())) {
if (!languageLevel.isAtLeast(LanguageLevel.JDK_1_8)) {
String description = JavaErrorBundle.message("annotation.duplicate.annotation");
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(element).descriptionAndTooltip(description).create();

View File

@@ -28,6 +28,10 @@ class C5 { }
@A6 @A6 <error descr="Container annotation 'AA6' must not be present at the same time as the element it contains">@AA6</error> class C6 { }
@A6 @A6 class C6bis1 { }
@A6 @AA6 class C6bis2 { }
@A6
@<error descr="Duplicate annotation. The declaration of 'AA6' does not have a valid java.lang.annotation.Repeatable annotation">AA6</error>
@<error descr="Duplicate annotation. The declaration of 'AA6' does not have a valid java.lang.annotation.Repeatable annotation">AA6</error>
class C6bis3 { }
@Target({TYPE_USE}) @interface TA { }
class DupTypeAnno {