@Nullable
  private static LocalQuickFix createFix(PsiElement target) {
    if (target instanceof PsiTypeElement && target.getParent() instanceof PsiVariable variable) {
      final PsiType type = getSuggestedType(variable);
      if (type != null) {
        final String typeText = GenericsUtil.getVariableTypeByExpressionType(type).getPresentableText();
        final String message =
          JavaBundle.message("raw.variable.type.can.be.generic.quickfix", variable.getName(), typeText);
        return new RawTypeCanBeGenericFix(message);
      }
    }
    if (target instanceof PsiJavaCodeReferenceElement ref) {
      PsiElement parent = target.getParent();
      if (parent instanceof PsiTypeElement typeElement) {
        PsiReferenceParameterList params = ref.getParameterList();
        // Can be erroneous empty <>
        if (params != null && !params.textMatches("")) return null;
        PsiTypeCastExpression cast = ObjectUtils.tryCast(typeElement.getParent(), PsiTypeCastExpression.class);
        if (cast == null) return null;
        if (!canUseUpperBound(cast)) return null;
        PsiClass psiClass = PsiUtil.resolveClassInClassTypeOnly(cast.getType());
        if (psiClass == null) return null;
        int count = psiClass.getTypeParameters().length;
        return new CastQuickFix(typeElement.getText() + StreamEx.constant("?", count).joining(",", "<", ">"));
      }
      else if (parent instanceof PsiNewExpression newExpression) {
        if (!PsiUtil.isAvailable(JavaFeature.DIAMOND_TYPES, parent)) return null;
        if (newExpression.isArrayCreation() || newExpression.getAnonymousClass() != null) return null;
        PsiType expectedType = ExpectedTypeUtils.findExpectedType(newExpression, false);
        if (expectedType == null || expectedType.equals(PsiTypes.nullType()) || 
            (expectedType instanceof PsiClassType && ((PsiClassType)expectedType).isRaw())) return null;
        PsiNewExpression copy = (PsiNewExpression)LambdaUtil.copyWithExpectedType(parent, expectedType);
        PsiJavaCodeReferenceElement reference = copy.getClassReference();
        if (reference == null) return null;
        PsiReferenceParameterList parameterList = reference.getParameterList();
        if (parameterList == null || !parameterList.textMatches("")) return null;
        parameterList.replace(PsiDiamondTypeUtil.createExplicitReplacement(parameterList));
        JavaResolveResult resolveResult = copy.resolveMethodGenerics();
        if (!resolveResult.isValidResult()) return null;
        PsiType diamondType = copy.getType();
        if (diamondType == null || !expectedType.isAssignableFrom(diamondType)) return null;
        return new UseDiamondFix();
      }
    }
    return null;
  }
@Nullable
  private static LocalQuickFix createFix(PsiElement target)