【问题标题】:Generated Javadoc is different from what NetBeans popup shows生成的 Javadoc 与 NetBeans 弹出窗口显示的不同
【发布时间】:2020-06-20 06:50:26
【问题描述】:

我正在使用 NetBeans 并有以下代码:

   public interface StackADT<E> extends Collection<E> {
        boolean push(E element);
        E pop();
        E peek();
   }

   public class ArrayStack<E> implements StackADT<E> {
       //other methods

       /** Adds all the elements of a given collection to
        *  the stack.
        * @param c the collection whose elements should be
        *          added.
        * @return <br>{@code true} if the collection does not
        *         contain {@code null} elements.
        */
       @Override
       public boolean addAll(Collection<? extends E> c) {
           //do stuff
       }
   }

当我为项目生成 Javadoc 时,它正确显示 this。但是,文档弹出窗口显示this。出于某种原因,return 标记显示了来自Collections' 文档的文本,这些文本应该被覆盖,但仅在弹出窗口中。我尝试重新启动 NetBeans 并重写该方法的 Javadoc 无效。有什么想法吗?

【问题讨论】:

  • 重写方法并更改其返回类型的含义是不寻常的。这可能也是 NetBeans 将 @returnjava.util.Collection&lt;E&gt; 中提取出来的原因。

标签: java netbeans javadoc


【解决方案1】:

这是一个错误。我为此创建了issuePR。我认为它将在 12.1 中修复。

您可以轻松检查它。如果您像这样更改您的 JavaDoc(将返回标记移到顶部):

   /** Adds all the elements of a given collection to
    *  the stack.
    * @return <br>{@code true} if the collection does not
    *         contain {@code null} elements.
    *
    * @param c the collection whose elements should be
    *          added.
    */

那么param标签的描述将被复制而不是return标签:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-10-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-19
    • 1970-01-01
    相关资源
    最近更新 更多