单行上的Javadoc多个变量
我有一个像下面这样的课……
class A{ /** * Blah blah */ Type1 var; /** * What do I do here? */ Type2 var11, var12; }
如果javadoc var11和var12都在同一行上怎么样?
我很想知道这是否可行,我知道我可以将它们放在一条线上并从那里开始javadoc。
我很好奇所以我试了一下
/** * data stuff */ int x , y ;
生成的javadoc重复了x和y的相同doc注释。 我想如果两个字段基本相同而且有微小的差异,这种行为会很有用。
class Circle { .... /** * center coordinates * The x/y coordinate of the center of this circle. */ int x , y ;
遗憾的是,没有办法区分多个变量的单行声明:(
然而,值得注意的是,这样做的好处确实允许单个javadoc为分类变量提供文档,否则这些变量可能会占用不必要的行。
/** * custom colors (MUST BE DISPOSED!) */ Color lightblue, someotherblue, lightred;
当然,这也可以与初始化相结合
/** * These are the spec's behind batch-box font size / Height / Width */ private int iFontHeight = 9, iboxheight = 58, iboxwidth = 125;