private static @NotNull PsiLocalVariable addVariable(@NotNull PsiLocalVariable variable,
                                                       @NotNull PsiElement variableSibling,
                                                       @NotNull PsiElement variableParent) {
    boolean hasConflictingDeclaration = hasConflictingDeclaration(variable, variableParent);
    PsiStatement declaration = JavaPsiFacade.getInstance(variableSibling.getProject()).getParserFacade()
      .createStatementFromText(variable.getText(), variableSibling);
    variable = (PsiLocalVariable)((PsiDeclarationStatement)variableParent.addBefore(declaration, variableSibling)).getDeclaredElements()[0];
    if (hasConflictingDeclaration) {
      String newVarName = JavaCodeStyleManager.getInstance(variableParent.getProject())
        .suggestUniqueVariableName(variable.getName(), variableParent, true);
      for (PsiReference ref : VariableAccessUtils.getVariableReferences(variable, variableParent)) {
        ref.handleElementRename(newVarName);
      }
      variable.setName(newVarName);
    }
    return variable;
  }
private static @NotNull PsiLocalVariable addVariable(@NotNull PsiLocalVariable variable,
                                                       @NotNull PsiElement variableSibling,
                                                       @NotNull PsiElement variableParent)