lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Karl Wettin <karl.wet...@gmail.com>
Subject Re: serialVersionUID issue between 2.3 and 2.4
Date Tue, 02 Dec 2008 04:42:46 GMT
You could get the 2.4 code and set the serialVersionUID of the Term  
class to the UID assigned to the 2.3 Term class (554776219862331599l)  
and recompile.

As for statically setting a serialVersionUID in the class, one could  
instead set it to a final value and implement Externalizable in order  
to keep binary compatibility between class versions that contains more  
changes than what the Serializable reflection support code can handle.  
That would also save a few clock ticks. All over I think that is a  
much better solution.


     karl

2 dec 2008 kl. 03.18 skrev Jason Rutherglen:

> Hi Mike,
>
> Can you build and release a 2.4 jar using the 2.3 build environment?
>
>> Besides having to remember to change the serialVersionUID, are  
>> there any
> known downsides to setting it explicitly?
>
> As far as I know it's all good.
>
> Jason
>
> On Mon, Dec 1, 2008 at 6:11 PM, Michael McCandless <
> lucene@mikemccandless.com> wrote:
>
>>
>> Jason Rutherglen wrote:
>>
>> if you don't set serialVersionUID yourself, then java assigns a
>>>>
>>> rather volatile one for you
>>>
>>> True however the Java specification defines how the serialVersionUID
>>> should
>>> be created in the event it's not defined.  The caveat being it's not
>>> strictly enforced and so Sun alternative compilers may decide to  
>>> change
>>> how
>>> it's created (from what I've read).  Base classes like Term and  
>>> Query
>>> don't
>>> change very often so we may want to settle on a serialVersionUID  
>>> for these
>>> top level classes.
>>>
>>
>> Makes sense.  Besides having to remember to change the  
>> serialVersionUID,
>> are
>> there any known downsides to setting it explicitly?
>>
>> Lucene sets it for 2 sources now (RAMFile & RAMDirectory).
>>
>> Was a different compiler used for the 2.4 release compared to 2.3?
>>>
>>
>> Likely, yes (two different people, Michael and Mike (me!), in  
>> different
>> envs,
>> did the releases).
>>
>> Mike
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message