Optional used as method argument? (original) (raw)

Roger Riggs Roger.Riggs at Oracle.com
Fri Oct 2 14:12:35 UTC 2015


+1

On 10/2/2015 9:51 AM, Sean Mullan wrote:

On 10/2/15 9:27 AM, Wang Weijun wrote:

在 2015年10月2日,下午8:49,Roger Riggs <Roger.Riggs at oracle.com> 写道:

+1 The "no such value" makes me curious about the context. The @param tag really should be saying something about the parameter. In fact, I'm working on a method which is similar to /* * Generates some random bytes. * * @param n requested random value in bytes. * @param extraEntropy optional entropy caller can provide, null if none. */ byte[] getRandom(int n, byte[] extraEntropy) Most caller won't be able to provide extra entropy, but if one does have a dedicated device which can generate fresh entropy, it is welcome. Alternatively, you could just add an overloaded method, and not allow a null value for extraEntropy: byte[] getRandom(int n) byte[] getRandom(int n, byte[] extraEntropy) --Sean



More information about the core-libs-dev mailing list