因此,當我在爲我的課程開發實驗室時,我使用了ALT + SHIFT + J Eclipse快捷方式爲我的函數自動生成Javadoc註釋。下面是一些例子,我有沒有問題:有趣的Eclipse JavaDoc評論者錯誤
// ----------------------------------------------------------
/**
* Mutator method for setting processorSpeed.
*
* @param newProcessorSpeed Updated processor speed value
*/
public void setProcessorSpeed(double newProcessorSpeed)
{
processorSpeed = newProcessorSpeed;
}
// ----------------------------------------------------------
/**
* Returns value of computer power
*
* @return numcores * processorSpeed
*/
public double computePower()
{
double temp = numcores * processorSpeed;
return temp;
}
然而,當我試圖做同樣的快捷鍵這樣的功能:
public String toString()
{
String temp =
processor + ", " + String.valueOf(numcores) + " cores at "
+ String.valueOf(processorSpeed) + "GHz";
return temp;
}
我得到的是:
// ----------------------------------------------------------
public String toString()
{
String temp =
processor + ", " + String.valueOf(numcores) + " cores at "
+ String.valueOf(processorSpeed) + "GHz";
return temp;
}
只是認爲這是一個有趣的錯誤。對Eclipse是如何以不同的方式處理toString函數感到好奇的。