private void writeStubConstructorInvocation(PsiMethod constructor, StringBuilder text) {
    final PsiClass containingClass = constructor.getContainingClass();
    if (containingClass == null) return;

    final PsiClass superClass = containingClass.getSuperClass();
    if (superClass == null) return;

    final PsiMethod[] constructors = superClass.getConstructors();
    if (constructors.length == 0) return;

    for (PsiMethod method : constructors) {
      if (method.getParameterList().isEmpty() && PsiUtil.isAccessible(method, containingClass, containingClass)) {
        return; //default constructor exists
      }
    }

    for (PsiMethod method : constructors) {
      if (PsiUtil.isAccessible(method, containingClass, containingClass)) {
        text.append("super(");
        writeStubConstructorInvocation(text, method, TypeConversionUtil.getSuperClassSubstitutor(superClass, containingClass, PsiSubstitutor.EMPTY), constructor);
        text.append(");");
        return;
      }
    }
  }
private void writeStubConstructorInvocation(PsiMethod constructor, StringBuilder text)