Javadoc displaying value on an inner class constant using @value

青春壹個敷衍的年華 提交于 2019-12-18 03:49:21

问题


I have an inner class which declares a constant and want to display its value in Javadoc of the enclosing top-level class using the @value annotation. For example:

/**
 * {@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;
  }
}

Any ideas how to display the value of BAR_CONS in Javadoc of the Foo class (or any other class, in general)?


回答1:


Javadoc format for constant defined in another package should be:
{@value package.class#field}

However, it potentially not rendering is a known issue:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=342194




回答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



来源:https://stackoverflow.com/questions/11426959/javadoc-displaying-value-on-an-inner-class-constant-using-value

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!