Jimmy Huch
Jimmy Huch

Reputation: 4540

Javadoc multiple variables on single line

I have a class like the following...

class A{

/**
 * Blah blah
 */
 Type1 var;

/**
 * What do I do here?
 */
 Type2 var11, var12;

}

How can I javadoc var11, and var12 if they are both on the same line?

I am curious to see if this is possible, I know I can put them both on an individual line and javadoc from there.

Upvotes: 9

Views: 3615

Answers (2)

Elysiumplain
Elysiumplain

Reputation: 721

unfortunately there is no way to differentiate single line declaration of multiple variables :(

It may be useful to note however that the benefit of this does allow for a single javadoc to provide documentation for categorical variables which may otherwise take unnecessary lines.

/**
 * custom colors (MUST BE DISPOSED!)
 */
Color lightblue, someotherblue, lightred;

of course this can be combined with initialization as well

/**
*  These are the spec's behind batch-box font size / Height / Width
*/
private int iFontHeight = 9, iboxheight = 58, iboxwidth = 125;

Upvotes: 0

emory
emory

Reputation: 10891

I was curious so I tried it out

/**
 * data stuff
 */
 int x , y ;

The resulting javadoc repeated the same doc comments for both x and y. I imagine this behavior would be useful if two fields were essentially the same with minor differences.

class Circle
{
    ....
    /**
     * center coordinates
     * The x/y coordinate of the center of this circle.
     */
     int x , y ;

Upvotes: 10

Related Questions