commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jörg Schaible <joerg.schai...@gmx.de>
Subject Re: svn commit: r785552 - in /commons/proper/math/trunk/src: java/org/apache/commons/math/complex/Complex.java site/xdoc/changes.xml
Date Thu, 18 Jun 2009 07:41:58 GMT
luc.maisonobe@free.fr wrote at Donnerstag, 18. Juni 2009 09:19:

> 
> ----- "Bill Barker" <billwbarker@verizon.net> a écrit :
> 
>> ----- Original Message -----
>> From: <luc.maisonobe@free.fr>
>> To: "Commons Developers List" <dev@commons.apache.org>
>> Sent: Wednesday, June 17, 2009 2:58 PM
>> Subject: Re: svn commit: r785552 - in /commons/proper/math/trunk/src:
>> 
>> java/org/apache/commons/math/complex/Complex.java
>> site/xdoc/changes.xml
>> 
>> 
>> 
>> >----- "Phil Steitz" <phil.steitz@gmail.com> a écrit :
>> >
>> >> Sorry if I am being dense here. What serialization problem do the
>> new
>> >> fields cause, exactly? The class is immutable and they are set by
>> the
>> >> constructor.
>> >
>> >It takes more space to store. If someone uses serialization to store
>> or
>> >send a bunch of complex >this will vastly increase the load.
>> 
>> The main problem is that the fields can be either transient or final,
>> but
>> not both (or rather, you can't reset the value of final fields in
>> readObject).  I have a slight preference for transient for the reason
>> Luc
>> gave (a BlockFieldMatrix<ComplexField> will get large quickly), and
>> have no
>> problem doing the change myself.  But I can wait for other opinions.
> 
> +1 for that.
> You can reset final fields in readObject, with some java.lang.reflect
> dirty tricks. Look at the DeserializeReal{Vector, Matrix} methods in
> MatrixUtils.

Starting with JDK 5 it is possible to write into final fields with
reflection. However, it also implies special rights running under a
SecurityManager. You get nothing for free.

- Jörg


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


Mime
View raw message