static HighlightInfo.Builder checkMemberValueType(@NotNull PsiAnnotationMemberValue value,
                                            @NotNull PsiType expectedType,
                                            @NotNull PsiMethod method) {
    if (expectedType instanceof PsiClassType && expectedType.equalsToText(CommonClassNames.JAVA_LANG_CLASS)) {
      if (!(value instanceof PsiClassObjectAccessExpression)) {
        String description = JavaErrorBundle.message("annotation.non.class.literal.attribute.value");
        return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(value).descriptionAndTooltip(description);
      }
    }
    PsiAnnotationMethod annotationMethod = ObjectUtils.tryCast(method, PsiAnnotationMethod.class);
    if (annotationMethod == null || annotationMethod instanceof SyntheticElement) return null;

    boolean fromDefaultValue = PsiTreeUtil.isAncestor(annotationMethod.getDefaultValue(), value, false);
    if (value instanceof PsiAnnotation) {
      PsiJavaCodeReferenceElement nameRef = ((PsiAnnotation)value).getNameReferenceElement();
      if (nameRef == null) return null;

      if (expectedType instanceof PsiClassType) {
        PsiClass aClass = ((PsiClassType)expectedType).resolve();
        if (aClass != null && nameRef.isReferenceTo(aClass)) return null;
      }

      if (expectedType instanceof PsiArrayType) {
        PsiType componentType = ((PsiArrayType)expectedType).getComponentType();
        if (componentType instanceof PsiClassType) {
          PsiClass aClass = ((PsiClassType)componentType).resolve();
          if (aClass != null && nameRef.isReferenceTo(aClass)) return null;
        }
      }

      String description = JavaErrorBundle.message("incompatible.types", JavaHighlightUtil.formatType(expectedType),
                                                   nameRef.getCanonicalText());
      HighlightInfo.Builder info =
        HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(value).descriptionAndTooltip(description);
      PsiClass annotationClass = ((PsiAnnotation)value).resolveAnnotationType();
      if (annotationClass != null) {
        IntentionAction annotationMethodReturnFix =
          QuickFixFactory.getInstance()
            .createAnnotationMethodReturnFix(annotationMethod, TypeUtils.getType(annotationClass), fromDefaultValue);
        info.registerFix(annotationMethodReturnFix, null, null, null, null);
      }
      return info;
    }

    if (value instanceof PsiArrayInitializerMemberValue arrayValue) {
      if (expectedType instanceof PsiArrayType) return null;
      String description = JavaErrorBundle.message("annotation.illegal.array.initializer", JavaHighlightUtil.formatType(expectedType));
      HighlightInfo.Builder info = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(value).descriptionAndTooltip(description);
      PsiAnnotationMemberValue[] initializers = arrayValue.getInitializers();
      if (initializers.length == 0) {
        PsiType arrayType = PsiTypesUtil.createArrayType(expectedType, 1);
        IntentionAction annotationMethodReturnFix =
          QuickFixFactory.getInstance().createAnnotationMethodReturnFix(method, arrayType, fromDefaultValue);
        info.registerFix(annotationMethodReturnFix, null, null, null, null);
      }
      PsiExpression firstInitializer = ObjectUtils.tryCast(ArrayUtil.getFirstElement(initializers), PsiExpression.class);
      if (firstInitializer == null || firstInitializer.getType() == null) return info;
      if (initializers.length == 1 &&
          TypeConversionUtil.areTypesAssignmentCompatible(expectedType, firstInitializer)) {
        IntentionAction action = QuickFixFactory.getInstance().createUnwrapArrayInitializerMemberValueAction(arrayValue);
        if (action != null) {
          info.registerFix(action, null, null, null, null);
        }
      }
      PsiType arrayType = PsiTypesUtil.createArrayType(firstInitializer.getType(), 1);
      IntentionAction annotationMethodReturnFix =
        QuickFixFactory.getInstance().createAnnotationMethodReturnFix(method, arrayType, fromDefaultValue);
      info.registerFix(annotationMethodReturnFix, null, null, null, null);
      return info;
    }

    if (value instanceof PsiExpression expr) {
      PsiType type = expr.getType();

      PsiClass psiClass = PsiUtil.resolveClassInType(type);
      if (psiClass != null &&
          psiClass.isEnum() &&
          !(expr instanceof PsiReferenceExpression && ((PsiReferenceExpression)expr).resolve() instanceof PsiEnumConstant)) {
        String description = JavaErrorBundle.message("annotation.non.enum.constant.attribute.value");
        return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(value).descriptionAndTooltip(description);
      }

      if (type != null && TypeConversionUtil.areTypesAssignmentCompatible(expectedType, expr) ||
          expectedType instanceof PsiArrayType &&
          TypeConversionUtil.areTypesAssignmentCompatible(((PsiArrayType)expectedType).getComponentType(), expr)) {
        return null;
      }

      String description = JavaErrorBundle
        .message("incompatible.types", JavaHighlightUtil.formatType(expectedType), JavaHighlightUtil.formatType(type));
      HighlightInfo.Builder info = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(value).descriptionAndTooltip(description);
      IntentionAction action1 = QuickFixFactory.getInstance().createSurroundWithQuotesAnnotationParameterValueFix(value, expectedType);
      info.registerFix(action1, null, null, null, null);
      if (type != null) {
        IntentionAction action = QuickFixFactory.getInstance().createAnnotationMethodReturnFix(method, type, fromDefaultValue);
        info.registerFix(action, null, null, null, null);
      }
      return info;
    }

    LOG.error("Unknown annotation member value: " + value);
    return null;
  }
static HighlightInfo.Builder checkMemberValueType(@NotNull PsiAnnotationMemberValue value,
                                            @NotNull PsiType expectedType,
                                            @NotNull PsiMethod method)