Hi. > >public interface UnivariateRealFunction { > >- > > /** > >- * Compute the value for the function. > >- * @param x the point for which the function value should be computed > >- * @return the value > >- * @throws FunctionEvaluationException if the function > >evaluation fails > >+ * Compute the value of the function. > >+ * > >+ * @param x Point at which the function value should be computed. > >+ * @return the value. > > */ > >- double value(double x) throws FunctionEvaluationException; > >- > >+ double value(double x); > >} > > > > IMHO we still need the @throws line in the javadoc. Otherwise end > users are going to get a nasty surprise when they get an unchecked > exception thrown.
Using the "throws" clause for unchecked exception is misleading because it can give the impression that it is necessary to propagate it (through a clause for the enclosing method) or to isolate it (in a try/catch block). Moreover, an equally false impression is that the code would be safe if this specific exception is caught. Adding the clause to the interface does not prevent an implementation to from throwing another unchecked exception, so it does not provide any information. And this is *no* change from the previous situation (where we had a checked exception). In the case where some code can continue even though the function evaluation fails (for whatever reason, and whatever the exception thrown), the only sure thing is that the call to "value" be enclosed in a "try" block that "catch"es "RuntimeException". Best, Gilles --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org