【发布时间】:2017-04-24 18:10:08
【问题描述】:
我正在寻找有关在我的代码中使用 Javadoc 标记的建议。我想遵守 Javadoc 样式指南,以及 @see 标记在这种特殊情况下是否合适。
我为其添加了 Javadoc 注释的代码示例
/**
*
* Will check if the given shader (vertex, fragment etc) compiled successfully!
*
* If the compilation was successful, no change will happen and nothing will be returned.
*
* @throws RuntimeException
* if there is an error in compiling the shader.
*/
使用以下内容是否合适?
/**
*
* Will check if the given shader (vertex, fragment etc) compiled successfully!
*
* If the compilation was successful, no change will happen and nothing will be returned.
*
* @see '@throws' for information on a compile error
*
* @throws RuntimeException
* Thrown if there is an error in compiling the shader.
*/
另外,“'@throws'”是否合适?是否可以删除它周围的引号或 javadoc 不会生成?
编辑
我不是在问@see 在引用另一个类时的用法。我说的是引用当前文档的一部分时的用法。因此,我为什么要询问 @throws 周围的引号
【问题讨论】:
-
不,因为那个人谈论的是方法引用而不是我所问的。
-
@user 我创建了一个概述差异的编辑
-
您真的需要在 javadoc 中使用本质上是“阅读下一行以获取更多信息”的内容吗?此外,抛出
RuntimeException非常广泛,描述并没有真正帮助。考虑到即使编译没有问题但其他问题也可以抛出RuntimeException(或其子类)。