boolean (@Nullable GrAnnotationMemberValue value, @NotNull PsiElement toHighlight) { if (value == null) return false; if (value instanceof GrLiteral) return false; if (value instanceof GrFunctionalExpression) return false; if (value instanceof GrAnnotation) return false; if (value instanceof GrReferenceExpression) { PsiElement resolved = ((GrReferenceExpression)value).resolve(); if (resolved instanceof PsiClass) return false; if (resolved instanceof PsiEnumConstant) return false; if (resolved == null && isClassReference(value)) return false; if (resolved instanceof GrAccessorMethod) resolved = ((GrAccessorMethod)resolved).getProperty(); if (resolved instanceof PsiField) { GrExpression initializer; try { if (resolved instanceof GrField) { initializer = ((GrField)resolved).getInitializerGroovy(); } else { final PsiExpression _initializer = ((PsiField)resolved).getInitializer(); initializer = _initializer != null ? (GrExpression)ExpressionConverter.getExpression(_initializer, GroovyLanguage.INSTANCE, value.getProject()) : null; } } catch (IncorrectOperationException e) { initializer = null; } if (initializer != null) { return checkAnnotationAttributeValue(initializer, toHighlight); } } } if (value instanceof GrAnnotationArrayInitializer) { for (GrAnnotationMemberValue expression : ((GrAnnotationArrayInitializer)value).getInitializers()) { if (checkAnnotationAttributeValue(expression, toHighlight)) return true; } return false; } if (value instanceof GrUnaryExpression) { final IElementType tokenType = ((GrUnaryExpression)value).getOperationTokenType(); if (tokenType == GroovyTokenTypes.mMINUS || tokenType == GroovyTokenTypes.mPLUS) { return checkAnnotationAttributeValue(((GrUnaryExpression)value).getOperand(), toHighlight); } } myHolder.newAnnotation(HighlightSeverity.ERROR, GroovyBundle.message("expected.0.to.be.inline.constant", value.getText())).range(toHighlight).create(); return true; }