public static boolean canInlineParameterOrThisVariable(PsiLocalVariable variable) {
    List<PsiReferenceExpression> refs = VariableAccessUtils.getVariableReferences(variable);
    boolean isAccessedForWriting = false;
    for (PsiReferenceExpression refElement : refs) {
      if (PsiUtil.isAccessedForWriting(refElement)) {
        isAccessedForWriting = true;
      }
    }
    if (refs.size() == 1 && !isAccessedForWriting && isFirstUse(variable, refs.get(0))) return true;

    PsiExpression initializer = variable.getInitializer();
    return canInlineParameterOrThisVariable(variable.getProject(), initializer, false, false,
                                            refs.size(), isAccessedForWriting);
  }
public static boolean canInlineParameterOrThisVariable(PsiLocalVariable variable)