nus-cs2113-AY2122S1 / forum

3 stars 1 forks source link

Javadocs empty details for parameters starting with "@" #157

Open theodorekwok opened 2 years ago

theodorekwok commented 2 years ago

Hi Prof, suppose the JavaDoc contains "@param" or "@return" or "@throws" but the author did not write any details for them, is it considered a coding standard violation?

for example something like this below where the method has params, return and throws /* Returns lateral location of the specified position. * If the position is unset, NaN is returned. * * @param * @param * @param * @return * @throws */ `

okkhoy commented 2 years ago

Yes. You need to mention what each is for.

theodorekwok commented 2 years ago

Thanks prof!

richwill28 commented 2 years ago

@okkhoy

On a related note, is omitting @param considered a violation? (even if it may be obvious) For example..

/**
 * Move the center of the object to the given point.
 */
void moveTo(Point c) {
    this.c = c;
}
okkhoy commented 2 years ago

Using @param is not mandatory if it is obvious; however, if you use it, it should not be empty.

naijie2108 commented 2 years ago

@okkhoy

Adding on the question by @richwill28, is omitting "@return" and "@throws" if they are obvious considered violations?

okkhoy commented 2 years ago

TL;DR: The same argument applies to those as well.

Details: However, in reality, @throws would be due to some specific reason that may not be obvious. Hence, you may have to include details about the @throws blocks. Again, if it is quite obvious, you can skip it.