private static @Nullable StringBuilder generateTextForInstanceOf(@Nullable PsiLocalVariable variable,
                                                                   @NotNull CommentTracker ct,
                                                                   @NotNull PsiInstanceOfExpression instanceOf,
                                                                   @NotNull PsiTypeElement typeElement) {
    StringBuilder text = new StringBuilder(ct.text(instanceOf.getOperand()));
    text.append(" instanceof ");
    PsiModifierList modifierList = variable != null ? variable.getModifierList() : null;
    JavaCodeStyleSettings codeStyleSettings = JavaCodeStyleSettings.getInstance(typeElement.getContainingFile());
    if (modifierList != null && modifierList.getTextLength() > 0) {
      modifierList.setModifierProperty(PsiModifier.FINAL, codeStyleSettings.GENERATE_FINAL_LOCALS);
      text.append(ct.text(modifierList)).append(' ');
    }
    else if (codeStyleSettings.GENERATE_FINAL_LOCALS) {
      text.append("final ");
    }
    text.append(typeElement.getText()).append(' ');
    if (instanceOf.getPattern() instanceof PsiDeconstructionPattern) {
      return null;
    }
    if (variable == null) {
      String name = new VariableNameGenerator(instanceOf, VariableKind.LOCAL_VARIABLE)
        .byType(typeElement.getType()).generate(true);
      text.append(name);
    }
    else {
      text.append(variable.getName());
    }
    return text;
  }
private static @Nullable StringBuilder generateTextForInstanceOf(@Nullable PsiLocalVariable variable,
                                                                   @NotNull CommentTracker ct,
                                                                   @NotNull PsiInstanceOfExpression instanceOf,
                                                                   @NotNull PsiTypeElement typeElement)