Le 12/11/2010 23:15, Gilles Sadowski a écrit : >>>> [...] >>>> Hence, I would propose to create a new "MathRuntimeException" (in package >>>> "exception") and move all the code currently in >>>> "MathIllegalArgumentException" >>>> over to that class. >>>> Then, "MathIllegalArgumentException" as well as "MathUserException" can >>>> inherit from it. >>>> >>>> What do you think? >>> >>> No problem for me. >> >> OK, I'll do it in trunk. Then you can copy it over to MATH_2_X. > > I've been to fast on this. > "MathIllegalArgumentException" cannot inherit from "MathRuntimeException" > (which itself inherits from "RuntimeException") because it must inherit from > "IllegalArgumentException" to maintain the required semantics! > > So we'll have code duplication in "MathIllegalArgumentException" and in > "MathRuntimeException". This is 3 instance fields, 2 constructors and 3 > methods. > > An alternative: Instead of the 3 fields, we could store an instance of > "MathRuntimeException" inside "MathIllegalArgumentException" and redirect > the 3 method calls to that instance. > > Even simpler would be to have "MathUserException" inherit from > "MathIllegalArgumentException"... > > Which do you prefer?
I would prefer the simpler code duplication here. It is only an exception, and has no complex behavior. Luc > >> [...] > > > Regards, > Gilles > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org > For additional commands, e-mail: dev-h...@commons.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org