簡體   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