28

我有一个内部类,它声明一个常量,并希望使用 @value 注释在封闭的顶级类的 Javadoc 中显示它的值。例如:

/**
 * {@value #FOO_CONS} // this displays well
 * {@value #BAR_CONS} // this does not work (checked in the latest Eclipse)
 * {@value Bar#BAR_CONS} // this does not work, either
 */
public Foo {
  public static final int FOO_CONS = 1;
  static class Bar {
    public static final int BAR_CONS = 42;
  }
}

任何想法如何在Foo类(或任何其他类)的 Javadoc 中显示 BAR_CONS 的值?

4

2 回答 2

15

在另一个包中定义的常量的 Javadoc 格式应该是:
{@value package.class#field}

但是,它可能无法呈现是一个已知问题:
https ://bugs.eclipse.org/bugs/show_bug.cgi?id=342194

于 2015-04-16T00:05:25.150 回答
2

if create javadoc for members with visibility "package" (which is the visibility for your Bar class) i get the constant in the javadoc under Foo.Bar

于 2013-05-03T00:04:41.613 回答