How to document (simple) preconditions of a Java method?
It is often the case that a method imposes constraints on its arguments that cannot be described by the type system. For example, a method might require that some argument be non-null, or some int-typed argument be positive. There might also be more complex preconditions, for example that a certain method was called before, or that a certain object is in some state. What is the best way to document this in Javadoc? For example, suppose I have the following public library function, where the argument cannot be negative: public void foo(int bar) { if (bar < 0) { throw new