gpt4 book ai didi

JavaDoc 覆盖

转载 作者:行者123 更新时间:2023-12-02 10:00:13 27 4
gpt4 key购买 nike

首先要解决重复的可能性:

我不是询问 Override 是什么、它的含义或 @Override 在 java 文档注释之外。那是我不是

/**Some JavaDoc Comment*/
@override
public void methodA(){}

这意味着什么。希望我强调得不够好。 我也没有询问何时使用@Override或javadoc是什么如何做 java doc注释。 (是的,我强调了很多,但我宁愿过度指定问题,也不愿无缘无故地被标记为重复)。

现在回答问题:

在java文档中,比较器类:https://docs.oracle.com/javase/8/docs/api/java/util/Comparator.html#compare-T-T-有以下 equals 方法说明:

Overrides:
equals in class Object
Parameters:
obj - the reference object with which to compare.
Returns:
true only if the specified object is also a comparator and it imposes the same ordering as this comparator.
See Also:
Object.equals(Object), Object.hashCode()

如何获取 JavaDoc 中的 Overrides 标记。当我输入 @Overrides 时,它实际上会输入描述“@Overrides”。如何获得像 Comparator 类中那样的 JavaDoc 标记以显示 Overrides: equals in class Object

最佳答案

基于此tech note (“自动重用方法注释”部分,大约向下三分之一),如果一个方法覆盖另一个方法,“覆盖”部分将由 JavaDoc 工具自动生成。

来自上述链接:

You can avoid re-typing doc comments by being aware of how the Javadoc tool duplicates (inherits) comments for methods that override or implement other methods. This occurs in three cases:

When a method in a class overrides a method in a superclass When a method in an interface overrides a method in a superinterface When a method in a class implements a method in an interface In the first two cases, if a method m() overrides another method, The Javadoc tool will generate a subheading "Overrides" in the documentation for m(), with a link to the method it is overriding.

In the third case, if a method m() in a given class implements a method in an interface, the Javadoc tool will generate a subheading "Specified by" in the documentation for m(), with a link to the method it is implementing.

In all three of these cases, if the method m() contains no doc comments or tags, the Javadoc tool will also copy the text of the method it is overriding or implementing to the generated documentation for m(). So if the documentation of the overridden or implemented method is sufficient, you do not need to add documentation for m(). If you add any documentation comment or tag to m(), the "Overrides" or "Specified by" subheading and link will still appear, but no text will be copied.

关于JavaDoc 覆盖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55692684/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com