mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
annotations: check that modifier list corresponds to class modifier list when ignore list during process declarations (IDEA-160106)
This commit is contained in:
@@ -61,6 +61,9 @@ public class AnnotationTargetUtil {
|
||||
}
|
||||
|
||||
if (owner instanceof PsiModifierList) {
|
||||
if (((PsiModifierList)owner).getNextSibling() instanceof PsiErrorElement) {
|
||||
return TargetType.EMPTY_ARRAY;
|
||||
}
|
||||
PsiElement element = ((PsiModifierList)owner).getParent();
|
||||
if (element instanceof PsiPackageStatement) {
|
||||
return PACKAGE_TARGETS;
|
||||
|
||||
@@ -467,8 +467,8 @@ public class PsiClassImplUtil {
|
||||
@NotNull LanguageLevel languageLevel,
|
||||
boolean isRaw,
|
||||
@NotNull GlobalSearchScope resolveScope) {
|
||||
if (last instanceof PsiTypeParameterList || last instanceof PsiModifierList) {
|
||||
return true; //TypeParameterList and ModifierList do not see our declarations
|
||||
if (last instanceof PsiTypeParameterList || last instanceof PsiModifierList && aClass.getModifierList() == last) {
|
||||
return true;
|
||||
}
|
||||
if (visited != null && visited.contains(aClass)) return true;
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
class Dummy {
|
||||
|
||||
public @interface Debug {
|
||||
String value() default "[no comment]";
|
||||
}
|
||||
|
||||
private static final class Constants {
|
||||
private static final String INPUT = "Input";
|
||||
}
|
||||
|
||||
<error descr="Annotations are not allowed here">@Dummy.Debug(Constants.INPUT)</error><EOLError descr="Identifier or type expected"></EOLError>
|
||||
}
|
||||
@@ -49,6 +49,7 @@ public class AnnotationsHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testRepeatable() { doTest8(); }
|
||||
public void testEnumValues() { doTest8(); }
|
||||
public void testReceiverParameters() { doTest8(); }
|
||||
public void testAnnotationOverIncompleteCode() { doTest(); }
|
||||
|
||||
private void doTest() {
|
||||
setLanguageLevel(LanguageLevel.JDK_1_7);
|
||||
|
||||
Reference in New Issue
Block a user