IDEA-113590 annotations as annotation values

This commit is contained in:
Max Medvedev
2013-09-20 17:35:31 +04:00
parent 732cafd6d6
commit 3e876f48e5
2 changed files with 19 additions and 0 deletions
@@ -1430,6 +1430,7 @@ public class GroovyAnnotator extends GroovyElementVisitor {
private boolean checkAnnotationAttributeValue(GrAnnotationMemberValue value, PsiElement toHighlight) {
if (value instanceof GrLiteral) return false;
if (value instanceof GrClosableBlock) return false;
if (value instanceof GrAnnotation) return false;
if (value instanceof GrReferenceExpression) {
PsiElement resolved = ((GrReferenceExpression)value).resolve();
@@ -1600,4 +1600,22 @@ def groovy2 = '''print <error descr="String end expected">'abc\\\\' </error>'''
""")
}
void testAnnotationAsAnnotationValue() {
testHighlighting('''\
@interface A {}
@interface B {
A[] foo()
}
@interface C {
A foo()
}
@B(foo = @A)
@B(foo = [@A])
@C(foo = @A)
@C(foo = <error descr="Cannot assign 'Integer' to 'A'">2</error>)
def foo
''')
}
}