commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilles Sadowski <gil...@harfang.homelinux.org>
Subject Re: [Math] FunctionEvaluationException in UnivariateRealFunction
Date Fri, 05 Nov 2010 21:39:03 GMT
Hello.

> [...]

Of course, I didn't overlook that you just ask for a
  @throws FunctionEvaluationException when the evaluation failed.
Javadoc comment.

I'm just reluctant to publicize a guideline that is not adhered to in CM!
Whenever a method is passed an argument that doesn't fulfill pre-conditions,
it throws an "IllegalArgumentException". But "FunctionEvaluationException"
is not a subclass of "IllegalArgumentException". Users who are passed a
"UnivariateRealFunction" instance should not rely that catching
"FunctionEvaluationException" will work in most cases!

So, should the Javadoc in fact be
  @throws IllegalArgumentException when the evaluation failed because
  of an invalid argument.
  @throws FunctionEvaluationException when the evaluation failed for any
  other reason.
?

Then, how do you extend your guidelines to make it clear when to use one or
the other?
You could write a document that would explain how good it would be if all
programs were using the same exceptions. But I must point out that CM isn't
a good example, with its policy of no dependencies. Why would anyone depend
on CM just for the sake of using CM exceptions?


Best regards,
Gilles

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message