@NotNull
  private static <T extends PsiModifierListOwner & PsiNamedElement> PsiMethod generateDelegateMethod(@NotNull PsiClass psiClass,
                                                                                                     @NotNull T psiElement,
                                                                                                     @NotNull PsiAnnotation psiAnnotation,
                                                                                                     @NotNull PsiMethod psiMethod,
                                                                                                     @NotNull PsiSubstitutor psiSubstitutor) {
    final PsiType returnType = psiSubstitutor.substitute(psiMethod.getReturnType());

    final LombokLightMethodBuilder methodBuilder = new LombokDelegateMethod(psiMethod)
      .withModifier(PsiModifier.PUBLIC)
      .withMethodReturnType(returnType)
      .withContainingClass(psiClass)
      //Have to go to original method, or some refactoring action will not work (like extract parameter oder change signature)
      .withNavigationElement(psiMethod);

    for (PsiTypeParameter typeParameter : psiMethod.getTypeParameters()) {
      final LightTypeParameterBuilder lightTypeParameter =
        new LightTypeParameterBuilder(typeParameter.getName(), psiMethod, typeParameter.getIndex());
      for (PsiClassType extendsListType : typeParameter.getExtendsListTypes()) {
        lightTypeParameter.getExtendsList().addReference((PsiClassType)psiSubstitutor.substitute(extendsListType));
      }
      for (PsiClassType implementsListType : typeParameter.getImplementsListTypes()) {
        lightTypeParameter.getImplementsList().addReference((PsiClassType)psiSubstitutor.substitute(implementsListType));
      }
      methodBuilder.withTypeParameter(lightTypeParameter);
    }

    final PsiReferenceList throwsList = psiMethod.getThrowsList();
    for (PsiClassType psiClassType : throwsList.getReferencedTypes()) {
      methodBuilder.withException(psiClassType);
    }

    final PsiParameterList parameterList = psiMethod.getParameterList();
    final PsiParameter[] psiParameters = parameterList.getParameters();
    for (final PsiParameter psiParameter : psiParameters) {
      final PsiType psiParameterType = psiSubstitutor.substitute(psiParameter.getType());
      methodBuilder.withParameter(psiParameter.getName(), psiParameterType);
    }

    final String codeBlockText = createCodeBlockText(psiElement, psiMethod, returnType, psiParameters);
    methodBuilder.withBodyText(codeBlockText);

    return methodBuilder;
  }
@NotNull
  private static <T extends PsiModifierListOwner & PsiNamedElement> PsiMethod generateDelegateMethod(@NotNull PsiClass psiClass,
                                                                                                     @NotNull T psiElement,
                                                                                                     @NotNull PsiAnnotation psiAnnotation,
                                                                                                     @NotNull PsiMethod psiMethod,
                                                                                                     @NotNull PsiSubstitutor psiSubstitutor)