![]() |
1
2
我不知道有这样的标准注解。 Java Concurrency in Practice 记录同步策略 . 以下几点提示有助于您使文档更清晰、更有用:
他们还使用了一些注释,这些注释不是标准的,而是他们推荐的(见附录A)。但是,对于方法,它们只提供
我建议用纯Javadoc清楚地记录需求。 |
![]() |
2
0
在我看来,处理这个问题的最好办法就是取消这个要求。将方法更改为private,并通过添加
然后,在javadoc中没有要指定的内容,尽管在public和private方法的描述中包含这些信息仍然很有用。
/** * Executes something on the EDT with the crazy argument specified. If this is * called outside of the EDT, it will schedule the work to be done on the EDT * as soon as possible. The actual work of this method is found in * {@link #executeSomethingInternal(int)}. * * @argument crazyArgument some crazy argument */ public void executeSomething(int crazyArgument) { if (SwingUtilities.isEventDispatchThread()) { this.executeSomethingInternal(crazyArgument); } else { Runnable r = new Runnable() { private int crazyArgument; public Runnable setCrazyArgument(int crazyArgument) { this.crazyArgument = crazyArgument; return this; } @Override public void run() { this.OuterClass.executeSomethingInternal(this.crazyArgument); } }.setCrazyArgument(crazyArgument); SwingUtilities.invokeLater(r); } } /** * This method actually does the work. It is guaranteed by this class to * always get called on the EDT. Users of this API should call * {@link #executeSomething(int)}. */ private void executeSomethingInternal(int crazyArgument) { // do work here } |
![]() |
Fraquack · Kotlin-接口方法引发的文档异常 7 年前 |
![]() |
Mohan · 为具有(模拟的)可选/默认参数的函数编写Javadoc 7 年前 |
![]() |
Jai · vararg方法的Javadoc链接 7 年前 |
![]() |
drJava · 在JavaDoc中将方法参数与类成员链接 7 年前 |
![]() |
Batman · Javadoc和继承的类 8 年前 |
![]() |
CrypticStorm · IntelliJ Javadoc每行增加一个星号 10 年前 |