Unexpected result for @value in javadoc

Javadoc seems to handle tags @valueonly for classes that declare reference fields and only links without a class name.

Example:

I have classes

/** {@value #F} */
public class A {
    public static final String F = "field";
}

and

/** {@value A#F} */
public class B {}

The jdad 1.7 javadoc tool processes the tag @valueon A, but for Bthe following warning appears:

warning - A#F (referenced by @value tag) is an unknown reference.

This waring also occurs when I try to reference a field in javadoc Aon A#F. When I use the tag @link, everything works as expected.

I cannot find documentation that mentions that a tag @valuecan only refer to fields declared in the class in which javadoc is located. Is this a bug or is there another way to get a tag @valueto display the value?

+4
1

: , A com.example, :

/** 
* {@value com.example.A#F} 
*/
public class B {}

, .

+3

Source: https://habr.com/ru/post/1538370/


All Articles