Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

unexpected result for @value in javadoc

Tags:

java

javadoc

Javadoc seems to only process @value tags on classes declaring the referenced fields and only references without the classname.

Example:

I have the classes

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

and

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

The jdk 1.7 javadoc tool processes the @value tag on A but for B I get the following warning:

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

This waring also occures when I try to reference the field in the javadoc of A with A#F. When I use a @link tag instead everything works as expected.

I could not find any documentation mentioning that the @value tag may only reference Fields declared in the class the javadoc is on. Is this a bug or is there another way to get the @value tag to display the value?

like image 413
Blank Chisui Avatar asked Apr 28 '14 09:04

Blank Chisui


1 Answers

Providing whole package name with referenced class solves my problem: Assuming class A is defined in package com.example, this works for me:

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

Hope it helps.

like image 90
volkan Avatar answered Oct 05 '22 12:10

volkan