@Nullable
  private static TypeConversionDescriptor findDirectConversion(PsiElement context,
                                                               PsiClassType to,
                                                               PsiType from,
                                                               TypeMigrationLabeler labeler) {
    final PsiClass toTypeClass = to.resolve();
    LOG.assertTrue(toTypeClass != null);

    final PsiElement parent = context.getParent();
    if (parent.equals(labeler.getCurrentRoot().getElement()) && ((PsiVariable)parent).getInitializer() == context) {

      return wrapWithNewExpression(from, to, (PsiExpression)context);
    }
    if (context instanceof PsiArrayAccessExpression) {
      return new TypeConversionDescriptor("$qualifier$[$val$]", "$qualifier$.get()[$val$]");
    }
    if (parent instanceof PsiAssignmentExpression) {
      final IElementType operationSign = ((PsiAssignmentExpression)parent).getOperationTokenType();
      if (operationSign == JavaTokenType.EQ) {
        final boolean rightInfected = ((PsiAssignmentExpression)parent).getLExpression() == context;
        final String replacement = rightInfected
                                   ? "$qualifier$ = $val$.get()"
                                   : "$qualifier$.set(" + coerceType("$val$", from, to, context) + ")";
        return new TypeConversionDescriptor("$qualifier$ = $val$", replacement, (PsiAssignmentExpression)parent);
      }
    }
    if (context instanceof PsiReferenceExpression) {
      final PsiExpression qualifierExpression = ((PsiReferenceExpression)context).getQualifierExpression();
      final PsiExpression expression = context.getParent() instanceof PsiMethodCallExpression && qualifierExpression != null
                                       ? qualifierExpression
                                       : (PsiExpression)context;
      return new TypeConversionDescriptor("$qualifier$", toPrimitive("$qualifier$.get()", from, context), expression);
    }
    if (context instanceof PsiPrefixExpression prefixExpression &&
        prefixExpression.getOperationSign().getTokenType() == JavaTokenType.EXCL) {
      return new TypeConversionDescriptor("!$qualifier$", "!$qualifier$.get()");
    }
    if (parent instanceof PsiExpressionStatement) {
      if (context instanceof PsiPostfixExpression postfixExpression) {
        final String sign = postfixExpression.getOperationSign().getText();

        return new TypeConversionDescriptor("$qualifier$" + sign,
                                            "$qualifier$.set(" +
                                            getBoxedWrapper(from,
                                                            to,
                                                            toPrimitive("$qualifier$.get()", from, context) + " " + sign.charAt(0) + " 1",
                                                            labeler,
                                                            context,
                                                            postfixExpression.getOperand().getText() + sign.charAt(0) + " 1") +
                                            ")");
      }
      else if (context instanceof PsiPrefixExpression prefixExpression) {
        final String sign = prefixExpression.getOperationSign().getText();
        final PsiExpression operand = prefixExpression.getOperand();
        return new TypeConversionDescriptor(sign + "$qualifier$",
                                            "$qualifier$.set(" +
                                            getBoxedWrapper(from,
                                                            to,
                                                            toPrimitive("$qualifier$.get()", from, context) + " " + sign.charAt(0) + " 1",
                                                            labeler,
                                                            context,
                                                            operand != null ? operand.getText() + sign.charAt(0) + " 1" : null) +
                                            ")");
      }
      else if (context instanceof PsiAssignmentExpression assignmentExpression) {
        final PsiJavaToken signToken = assignmentExpression.getOperationSign();
        final IElementType operationSign = signToken.getTokenType();
        final String sign = signToken.getText();
        final PsiExpression lExpression = assignmentExpression.getLExpression();
        if (operationSign == JavaTokenType.EQ) {
          if (lExpression instanceof PsiReferenceExpression) {
            final PsiElement element = ((PsiReferenceExpression)lExpression).resolve();
            if (element instanceof PsiVariable && ((PsiVariable)element).hasModifierProperty(PsiModifier.FINAL)) {
              return wrapWithNewExpression(from, to, ((PsiAssignmentExpression)context).getRExpression());
            }
          }
          return new TypeConversionDescriptor("$qualifier$ = $val$",
                                              "$qualifier$.set(" + coerceType("$val$", from, to, context) + ")");
        }
        else {
          final PsiExpression rExpression = assignmentExpression.getRExpression();
          String boxedWrapper = getBoxedWrapper(from, to, toPrimitive("$qualifier$.get()", from, context) + " " + sign.charAt(0) + " $val$",
                                                labeler, context,
                                                rExpression != null
                                                ? lExpression.getText() + sign.charAt(0) + rExpression.getText()
                                                : null);
          return new TypeConversionDescriptor("$qualifier$" + sign + "$val$", "$qualifier$.set(%s)".formatted(boxedWrapper));
        }
      }
    }
    return null;
  }
@Nullable
  private static TypeConversionDescriptor findDirectConversion(PsiElement context,
                                                               PsiClassType to,
                                                               PsiType from,
                                                               TypeMigrationLabeler labeler)