private static @Nullable String generateStubFromTemplate(@Nullable PsiJavaDocumentedElement commentOwner) {
    if (commentOwner == null) return null;
    FileTemplate template = findTemplateByElement(commentOwner);
    if (template == null) return null;

    Map<String, Object> attributes = collectContextAttributes(commentOwner);
    Properties properties = FileTemplateManager.getInstance(commentOwner.getProject()).getDefaultProperties();
    for (String property : properties.stringPropertyNames()) {
      attributes.put(property, properties.getProperty(property));
    }
    try {
      return template.getText(attributes);
    }
    catch (IOException e) {
      LOG.trace(e);
      return null;
    }
  }
private static @Nullable String generateStubFromTemplate(@Nullable PsiJavaDocumentedElement commentOwner)