繁体   English   中英

如何修复checkstyle错误“期望@return标签。”?

[英]How do I fix the checkstyle error “Expected an @return tag.”?

检查样式后,我的代码段返回:“ [ERROR] UserInfo.java:39:预期为@return标记。[JavadocMethod]”

我只是想将javadoc注释添加到我的代码中,而以前从未遇到过此问题。 我不知道要在Javadoc注释中添加什么内容来解决下一部分(这就是为什么在“定义信息格式”之后它为空白)

 /**
 * Defines format of information.
 *
 * 
 *
 */
 public String toString()
 {
    String output = "Name: " + firstName + " "
       + lastName + "\n";
    output += "Location: " + location + "\n";
    output += "Age: " + age + "\n";
    output += "Status: ";
    if (status == OFFLINE)
    {
       output += "Offline";
    }
    else
    {
       output += "Online";
    }

    return output;
 }

最简单的方法是在javadoc注释中添加一个@return标记,该标记描述函数返回的内容。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM