public static Pair<PsiElement, @InspectionMessage String> checkAnnotationArguments(@NotNull PsiClass annotation,
                                                                                     GrAnnotationNameValuePair @NotNull [] attributes,
                                                                                     boolean checkMissedAttributes) {
    Set<String> usedAttrs = new HashSet<>();

    if (attributes.length > 0) {
      final PsiElement identifier = attributes[0].getNameIdentifierGroovy();
      if (attributes.length == 1 && identifier == null) {
        Pair.NonNull<PsiElement, String> r =
          checkAnnotationValue(annotation, attributes[0], "value", usedAttrs, attributes[0].getValue());
        if (r != null) return r;
      }
      else {
        for (GrAnnotationNameValuePair attribute : attributes) {
          final String name = attribute.getName();
          if (name != null) {
            final PsiElement toHighlight = attribute.getNameIdentifierGroovy();
            assert toHighlight != null;
            Pair.NonNull<PsiElement, String> r = checkAnnotationValue(annotation, toHighlight, name, usedAttrs, attribute.getValue());
            if (r != null) return r;
          }
        }
      }
    }

    List<String> missedAttrs = new ArrayList<>();
    final PsiMethod[] methods = annotation.getMethods();
    for (PsiMethod method : methods) {
      final String name = method.getName();
      if (usedAttrs.contains(name) ||
          method instanceof PsiAnnotationMethod && ((PsiAnnotationMethod)method).getDefaultValue() != null) {
        continue;
      }
      missedAttrs.add(name);
    }

    if (checkMissedAttributes && !missedAttrs.isEmpty()) {
      return Pair.create(null, GroovyBundle.message("missed.attributes", StringUtil.join(missedAttrs, ", ")));
    }
    return null;
  }
public static Pair<PsiElement, @InspectionMessage String> checkAnnotationArguments(@NotNull PsiClass annotation,
                                                                                     GrAnnotationNameValuePair @NotNull [] attributes,
                                                                                     boolean checkMissedAttributes)