@NotNull
  private static Pair<Object, String> attributeValueOrError(@NotNull PsiAnnotation annotation,
                                                            Class<? extends Annotation> type,
                                                            @Nullable @NonNls String attributeName) {
    PsiNameValuePair attribute = AnnotationUtil.findDeclaredAttribute(annotation, attributeName);
    final PsiAnnotationMemberValue value = attribute == null ? null : attribute.getValue();

    if (value != null) {
      Object result = JavaPsiFacade.getInstance(annotation.getProject()).getConstantEvaluationHelper().computeConstantExpression(value);

      if (result == null) {
        return Pair.create(null, "Unable to evaluate annotation value '" + value.getText() + "'");
      }

      // todo arrays
      return Pair.create(result, null);
    }

    if (attributeName == null) attributeName = "value";
    Method method;
    try {
      method = type.getMethod(attributeName);
    }
    catch (NoSuchMethodException e) {
      return Pair.create(null, "Method not found: " + attributeName);
    }
    Object defaultValue = method.getDefaultValue();
    if (defaultValue == null) {
      return Pair.create(null, "No default value is specified for method " + attributeName);
    }
    return Pair.create(defaultValue, null);
  }
@NotNull
  private static Pair<Object, String> attributeValueOrError(@NotNull PsiAnnotation annotation,
                                                            Class<? extends Annotation> type,
                                                            @Nullable @NonNls String attributeName)