private static void patchThisExpression(PsiMethod methodCopy, PsiClass containingClass) {
    PsiClass classCopy = methodCopy.getContainingClass();
    List<PsiThisExpression> these = new ArrayList<>();
    methodCopy.accept(new JavaRecursiveElementWalkingVisitor() {
      @Override
      public void visitThisExpression(@NotNull PsiThisExpression expression) {
        super.visitThisExpression(expression);
        if (PsiUtil.resolveClassInType(expression.getType()) == classCopy) {
          these.add(expression);
        }
      }
    });
    if (!these.isEmpty()) {
      PsiElementFactory f = PsiElementFactory.getInstance(containingClass.getProject());
      PsiParameter __this__ = f.createParameter("__this__", f.createType(containingClass));
      methodCopy.getParameterList().add(__this__);
      for (PsiThisExpression thisExpr : these) {
        PsiExpression newExpr = f.createExpressionFromText("__this__", thisExpr);
        thisExpr.replace(newExpr);
      }
    }
  }
private static void patchThisExpression(PsiMethod methodCopy, PsiClass containingClass)