commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Dunning <>
Subject Re: [math] Serialization
Date Mon, 25 May 2009 06:47:11 GMT

Did you commit those changes?

I ask because I see similar issues with abstract and static classes.  Gamma
is an example of the static class issue.  This class has only static
methods, but it is marked as serializable (why?).  ContinuedFraction is a
good example of an abstract class that is marked as serializable.  This
latter case leads to code that is either strange or incorrect.  The strange
version has a version identifier even on anonymous classes as in this code

         // create continued fraction
            ContinuedFraction cf = new ContinuedFraction() {

                private static final long serialVersionUID =

                protected double getA(int n, double x) {
                    return ((2.0 * n) + 1.0) - a + x;

                protected double getB(int n, double x) {
                    return n * (a - n);

            ret = 1.0 / cf.evaluate(x, epsilon, maxIterations);
            ret = Math.exp(-x + (a * Math.log(x)) - logGamma(a)) * ret;

If the serialVersionUID is ommitted, the anonymous class would be
incorrectly serialized because it would inherit it's parent UID (I think).
More importantly, I can't imagine why an abstract class like
ContinuedFraction should be serializable.

On Sun, May 24, 2009 at 6:10 PM, Bill Barker <>wrote:

> Ok, most of the rest look like transient classes (e.g. all of
> linear.decomposition).  So asking for what needs to be Serialized, and what
> doesn't.

Ted Dunning, CTO

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message