Show Array Value in Javadocs

Show Array Value in Javadocs

Lets say I have got such code:

private static final int[] ARRAY = {5, 10, 15};

/**
 * ????
 */
public void doSomething()
{}

I am wondering, if is there any way to put value of the ARRAY into documentation of doSomething() method. I can see that @value #ARRAY isn't working at all for arrays :( @link #ARRAY is not showing me the value.

Am I missing something?

5

1 Answer

The problem is that @value only works for constants, i.e. static final values. The array contents are not constants, only the array object itself is. You can change the values at any time. So it doesn't make sense, technically, to show the values. The array object itself can't be shown at Javadoc creation time in any useful way, like any other object (except Strings).

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Marcus Vance
Author

Marcus Vance

Marcus Vance is a cybersecurity auditor and technology writer dedicated to educating the public about online safety, data privacy regulations, enterprise security, and emerging cyber threats.