Return-Path: Delivered-To: apmail-geronimo-dev-archive@www.apache.org Received: (qmail 2771 invoked from network); 31 Aug 2006 15:34:55 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 31 Aug 2006 15:34:55 -0000 Received: (qmail 98764 invoked by uid 500); 31 Aug 2006 15:34:52 -0000 Delivered-To: apmail-geronimo-dev-archive@geronimo.apache.org Received: (qmail 98719 invoked by uid 500); 31 Aug 2006 15:34:52 -0000 Mailing-List: contact dev-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list dev@geronimo.apache.org Received: (qmail 98707 invoked by uid 99); 31 Aug 2006 15:34:52 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 31 Aug 2006 08:34:52 -0700 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=DNS_FROM_RFC_ABUSE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of heinz.drews@gmail.com designates 66.249.92.175 as permitted sender) Received: from [66.249.92.175] (HELO ug-out-1314.google.com) (66.249.92.175) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 31 Aug 2006 08:34:50 -0700 Received: by ug-out-1314.google.com with SMTP id m2so630392uge for ; Thu, 31 Aug 2006 08:34:28 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=sJaG8LxZy41QHDtmNQJVYHBqKdvlPMf7skTc9JX1HevNVmkZyZ3O9Gui/BhBZAX+j77WJvueX7umu3zMna5ZTgtgQ9tc+/N9sGlsZW4JX/K45PsaWXwIgMKMcDJ/X1Ux+GpXJMrzZObkyfad/GXUMAnATUYt+EE57sPwacKH4Qc= Received: by 10.66.244.10 with SMTP id r10mr594227ugh; Thu, 31 Aug 2006 08:34:28 -0700 (PDT) Received: by 10.67.26.20 with HTTP; Thu, 31 Aug 2006 08:34:28 -0700 (PDT) Message-ID: <4369f0ce0608310834r4c5969bev3d17d39309c56874@mail.gmail.com> Date: Thu, 31 Aug 2006 17:34:28 +0200 From: "Heinz Drews" To: dev@geronimo.apache.org Subject: Re: Standard for serialVersionUID In-Reply-To: <3D8E84095C6A524A985B787423094E4039F2F1@mssmsx411> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <3D8E84095C6A524A985B787423094E4039F2F1@mssmsx411> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hello Vasily, in several projects we had made serialVersionUID mandatory for all serializables. And because it's just an id a lot of opinions are coming up in discussions how to specify it. Just as clarification, in the approach with the version number it was not changed with each modification. Only if a change was causing an impact to the serialized version. Rationale was that in case of a mismatch the message would be easier to interpret then the traditional values. But I guess the traditional approach would be the preferred. Regards, Heinz On 8/31/06, Zakharov, Vasily M wrote: > Heinz, > > Adding serialVersionUIDs to Serializable classes is sure a great idea! > It's strongly recommended by Sun, and all the way helps when dealing > with serialization in large projects. > > It's not in fact important what particular value you specify for > serialVersionUID field, the only thing important is you change the > serialVersionUID for a class when its serialized form changes, and ONLY > if its serialized form changes. From this perspective, using class > version number is not a good idea, as a class may be modified (and thus > version number changed), but a serialized form may stay the same, and > changing serialVersionUID would introduce an unnecessary serialization > incompatibility. > > The traditional way is to use 'serialver' program from Sun's JDK. If > this way is for some reason uncomfortable for you, you may use some > other way to calculate serialVersionUIDs, like Eclipse built-in feature > or the like. The particular value is not important, only changes to it > are. > > Note however, that small values like 1 or 2 are traditionally used as > serialVersionUIDs for synthetic and other system classes, like Enums and > RMI Stubs, that are serialized in a special way. So using such values in > "normal" classes may confuse the future readers of the code and make > them wonder if that particular class is serialized in a special way. So > I'm suggesting using traditional (20-digit or so) values for > serialVersionUIDs. > > Thank you! > > Vasily Zakharov > Intel Middleware Products Division > > > -----Original Message----- > From: Heinz Drews [mailto:heinz.drews@gmail.com] > Sent: Thursday, August 31, 2006 9:46 AM > To: geronimo-dev > Subject: Standard for serialVersionUID > > As I have mentioned in another message I have accidently used class > files in modules created by Eclipse embeded compiler. This calculates > serialVersionUID different way then javac. > > I think that adding serialVersionUID to all serializable class would > address the situation best. > There are quite a number of class without the uid. I would volunteer > to add them but which standard should be used? > > Eclipse provides the option set it to 1 or to calculate the uid. But > the calculation is different to the one doen by javac. > > In other projects I have found the convention to use version number to > support detection of incompatible modifications. The version number a > much nicer to read in the message reporting mismatches than the > generated ones. > > Least impact would be to calculate the value with the serialver tool. > This avoids the need for redeploying. > > Which standard should be chosen? > > --Heinz >