You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Simon Kitching <si...@chello.at> on 2007/10/19 15:00:49 UTC

[shared] trivial fix for missing serialVersionUID

Hi All,

I'd like to make a trivial commit to add serialVersionUID values to two classes in shared that don't yet have them. This avoids compile warnings in IDEs that have "warn on missing serialVersionUID" set.

Adding the serialVersionUID is technically the right thing to do, IMO although in practice I agree it isn't terribly important for these particular classes.

Any objections?

Cheers,

Simon

Index: /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
===================================================================
--- /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java	(revision 586396)
+++ /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java	(working copy)
@@ -74,6 +74,7 @@
     public static final String SELECT_ITEM_LIST_ATTR = RendererUtils.class.getName() + ".LIST";
     public static final String EMPTY_STRING = "";
     public static final Object NOTHING = new Serializable() {
+        private static final long serialVersionUID = -8618356560493578754L;
     };
 
     public static final String ACTION_FOR_LIST = "org.apache.myfaces.ActionForList";


Index: /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/util/servlet/SourceCodeServlet.java
===================================================================
--- /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/util/servlet/SourceCodeServlet.java	(revision 586396)
+++ /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/util/servlet/SourceCodeServlet.java	(working copy)
@@ -25,6 +25,8 @@
 
 public class SourceCodeServlet extends HttpServlet 
 {
+    private static final long serialVersionUID = -2233965185519715475L;
+
     public void doGet(HttpServletRequest req, HttpServletResponse res)
         throws IOException, ServletException
     {


Re: [shared] trivial fix for missing serialVersionUID

Posted by Mario Ivankovits <ma...@ops.co.at>.
Hi!
> Of course the reason I asked in the first place is to see what the
> consensus opinion is on this...
>   
Well, since your both classes do not contain any member I too think it 
is safe to add the svUID there.

In more complex cases where we add the svUID just do get rid of the 
warning I think adding a comment about when to change the UID would be 
helpful.

Sorry for pushing this (minor) topic .... I just forgot to talk about 
this with you previously and with your thread it popped up in my brain 
again :-)

Ciao,
Mario


Re: [shared] trivial fix for missing serialVersionUID

Posted by simon <si...@chello.at>.
On Fri, 2007-10-19 at 17:56 +0200, Mario Ivankovits wrote:
> Hi!
> 
> Just some random thoughts ...
> 
> I am still not sure that it is a good idea to add the serialVersionUID.
> 
> The reasons are:
> * It is currently not there as no one cares about the "serializability" 
> of class, it is just serializable to make e.g. the servlet container and 
> clustering happy

Well, these classes must be serializable because in some situations the
container does serialize them and then reload them.

Agreed, for these particular classes it is unlikely that there would be
two different (but compatible) versions of this class around (see
below). However in general, the warning about an implicit
serialVersionUID does need to be taken seriously I think.

> * But if no one cares it is dangerous to add as then also no one will 
> update this serialVersionUID
> * which will in the end make the java serialization stuff make think it 
> can deserialize the class (the UID didn't change) and it start reading 
> the stream - java is safe enough to deal with, but why rely on this.
> What I mean is, if the UID changes it will not happen that a getLong 
> will try to read for example a double, it will fail early and no reason 
> to assume that the underlying serialization process deals correctly with 
> changing data types.
> 
> When not adding this UID nothing bad will happen as java recalculates it 
> safely.

Yes, this is good advice in general. I agree that unless the developer
community can be relied on to correctly update a serialVersionUID then
auto-assignment is better than manual assignment for exactly the reasons
you list. And even some quite experienced programmers are not aware of
when a serialVersionUID needs to be updated (or can just forget).
Ideally something like CLIRR would detect this :-)

However in these *particular* cases, a change that will alter the
serialization format is unlikely. One class is completely empty, and the
other is a Servlet that has no members at all. I cannot see any reason
to add members to either of these classes.

And in the end adding a serialVersionUID is the *right thing to do*.
Yes, possibly not the *safest* in all cases, but still *right*.

> 
> Why not simply disable the warning in your IDE?

Using @SuppressWarnings would be an excellent solution in this case -
but it is not supported in java14.

Eclipse (and probably other IDEs) have no mechanism to disable this
warning just for specific classes AFAIK. And if they did, every user
would have to repeat this (well, if they cared).

Disabling all serialization warnings is not good; these warnings really
can be useful in other cases. For example, there are a number of places
in Orchestra where proper serialVersionUIDs really would be good to
assign, and the warnings are reminders to deal with that sometime.
ConversationManager really can be passed between machines in a cluster,
and so we *should* assign a proper serialVersionUID for that (and keep
it correctly updated!). It's probably best to not do that yet though -
too much flux in that class ATM, so having the warning is a good TODO
reminder.

I do use the compiler warnings lists to check for errors, and it's
annoying for some entries in the list to be "permanent". This is not an
important enough reason to introduce bugs/traps into the code, but in
the case of these two particular classes I think adding a
serialVersionUID is not in that category (though for other classes it
might be true).


Of course the reason I asked in the first place is to see what the
consensus opinion is on this...

Regards,

Simon

> >
> > On 10/19/07, Simon Kitching <si...@chello.at> wrote:
> >   
> >> Hi All,
> >>
> >> I'd like to make a trivial commit to add serialVersionUID values to two classes in shared that don't yet have them. This avoids compile warnings in IDEs that have "warn on missing serialVersionUID" set.
> >>
> >> Adding the serialVersionUID is technically the right thing to do, IMO although in practice I agree it isn't terribly important for these particular classes.
> >>
> >> Any objections?
> >>
> >> Cheers,
> >>
> >> Simon
> >>
> >> Index: /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
> >> ===================================================================
> >> --- /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java   (revision 586396)
> >> +++ /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java   (working copy)
> >> @@ -74,6 +74,7 @@
> >>      public static final String SELECT_ITEM_LIST_ATTR = RendererUtils.class.getName() + ".LIST";
> >>      public static final String EMPTY_STRING = "";
> >>      public static final Object NOTHING = new Serializable() {
> >> +        private static final long serialVersionUID = -8618356560493578754L;
> >>      };
> >>
> >>      public static final String ACTION_FOR_LIST = "org.apache.myfaces.ActionForList";
> >>
> >>
> >> Index: /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/util/servlet/SourceCodeServlet.java
> >> ===================================================================
> >> --- /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/util/servlet/SourceCodeServlet.java    (revision 586396)
> >> +++ /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/util/servlet/SourceCodeServlet.java    (working copy)
> >> @@ -25,6 +25,8 @@
> >>
> >>  public class SourceCodeServlet extends HttpServlet
> >>  {
> >> +    private static final long serialVersionUID = -2233965185519715475L;
> >> +
> >>      public void doGet(HttpServletRequest req, HttpServletResponse res)
> >>          throws IOException, ServletException
> >>      {
> >>
> >>
> >>     
> >
> >
> >   
> 


Re: [shared] trivial fix for missing serialVersionUID

Posted by Mario Ivankovits <ma...@ops.co.at>.
Hi!

Just some random thoughts ...

I am still not sure that it is a good idea to add the serialVersionUID.

The reasons are:
* It is currently not there as no one cares about the "serializability" 
of class, it is just serializable to make e.g. the servlet container and 
clustering happy
* But if no one cares it is dangerous to add as then also no one will 
update this serialVersionUID
* which will in the end make the java serialization stuff make think it 
can deserialize the class (the UID didn't change) and it start reading 
the stream - java is safe enough to deal with, but why rely on this.
What I mean is, if the UID changes it will not happen that a getLong 
will try to read for example a double, it will fail early and no reason 
to assume that the underlying serialization process deals correctly with 
changing data types.

When not adding this UID nothing bad will happen as java recalculates it 
safely.

Why not simply disable the warning in your IDE?

Ciao,
Mario
> go ahead.
>
> -M
>
> On 10/19/07, Simon Kitching <si...@chello.at> wrote:
>   
>> Hi All,
>>
>> I'd like to make a trivial commit to add serialVersionUID values to two classes in shared that don't yet have them. This avoids compile warnings in IDEs that have "warn on missing serialVersionUID" set.
>>
>> Adding the serialVersionUID is technically the right thing to do, IMO although in practice I agree it isn't terribly important for these particular classes.
>>
>> Any objections?
>>
>> Cheers,
>>
>> Simon
>>
>> Index: /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
>> ===================================================================
>> --- /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java   (revision 586396)
>> +++ /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java   (working copy)
>> @@ -74,6 +74,7 @@
>>      public static final String SELECT_ITEM_LIST_ATTR = RendererUtils.class.getName() + ".LIST";
>>      public static final String EMPTY_STRING = "";
>>      public static final Object NOTHING = new Serializable() {
>> +        private static final long serialVersionUID = -8618356560493578754L;
>>      };
>>
>>      public static final String ACTION_FOR_LIST = "org.apache.myfaces.ActionForList";
>>
>>
>> Index: /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/util/servlet/SourceCodeServlet.java
>> ===================================================================
>> --- /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/util/servlet/SourceCodeServlet.java    (revision 586396)
>> +++ /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/util/servlet/SourceCodeServlet.java    (working copy)
>> @@ -25,6 +25,8 @@
>>
>>  public class SourceCodeServlet extends HttpServlet
>>  {
>> +    private static final long serialVersionUID = -2233965185519715475L;
>> +
>>      public void doGet(HttpServletRequest req, HttpServletResponse res)
>>          throws IOException, ServletException
>>      {
>>
>>
>>     
>
>
>   


Re: [shared] trivial fix for missing serialVersionUID

Posted by Matthias Wessendorf <ma...@apache.org>.
go ahead.

-M

On 10/19/07, Simon Kitching <si...@chello.at> wrote:
> Hi All,
>
> I'd like to make a trivial commit to add serialVersionUID values to two classes in shared that don't yet have them. This avoids compile warnings in IDEs that have "warn on missing serialVersionUID" set.
>
> Adding the serialVersionUID is technically the right thing to do, IMO although in practice I agree it isn't terribly important for these particular classes.
>
> Any objections?
>
> Cheers,
>
> Simon
>
> Index: /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
> ===================================================================
> --- /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java   (revision 586396)
> +++ /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java   (working copy)
> @@ -74,6 +74,7 @@
>      public static final String SELECT_ITEM_LIST_ATTR = RendererUtils.class.getName() + ".LIST";
>      public static final String EMPTY_STRING = "";
>      public static final Object NOTHING = new Serializable() {
> +        private static final long serialVersionUID = -8618356560493578754L;
>      };
>
>      public static final String ACTION_FOR_LIST = "org.apache.myfaces.ActionForList";
>
>
> Index: /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/util/servlet/SourceCodeServlet.java
> ===================================================================
> --- /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/util/servlet/SourceCodeServlet.java    (revision 586396)
> +++ /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/util/servlet/SourceCodeServlet.java    (working copy)
> @@ -25,6 +25,8 @@
>
>  public class SourceCodeServlet extends HttpServlet
>  {
> +    private static final long serialVersionUID = -2233965185519715475L;
> +
>      public void doGet(HttpServletRequest req, HttpServletResponse res)
>          throws IOException, ServletException
>      {
>
>


-- 
Matthias Wessendorf

further stuff:
blog: http://matthiaswessendorf.wordpress.com/
mail: matzew-at-apache-dot-org

Re: [shared] trivial fix for missing serialVersionUID

Posted by Scott O'Bryan <da...@gmail.com>.
Indeed the serialVersionUID is used to distinguish between two versions 
of the same class.  And simply put, it's a performance enhancement.  If 
serialVersionUID is not present, Java will calculate one based on the 
hash (I think).  The thing is that needing to calculate a "hash" each 
time a class is serialized takes time.  So providing a serialVersionUID 
is a lot more efficient.

The thing you have to watch out for is if there is anything that will 
break serial compatibility, you need to be sure to increment (or 
recalculate) the serialVersionUID.

Scott

Martin Marinschek wrote:
> Exactly - that's for sure. If it wasn't like that, Eclipse wouldn't
> use 1 as a default version id. If it was like Dennis suggested, every
> app built with Eclipse would go kaboom.
>
> ;)
>
> regards,
>
> Martin
>
> On 10/24/07, Mike Kienenberger <mk...@gmail.com> wrote:
>   
>> Yes, wouldn't that have to be the case?   Otherwise, A.jar and B.jar,
>> created by two independent groups, might use the same version id
>> without realizing it, and thus break a project depending on both of
>> them.
>>
>>
>> On 10/24/07, Martin Marinschek <ma...@gmail.com> wrote:
>>     
>>> The stream identifier will take into account the FQCN, and the
>>> version-identifier - so the two classes won't have the same stream
>>> identifier, IMHO.
>>>
>>> regards,
>>>
>>> Martin
>>>
>>> On 10/19/07, Dennis Byrne <de...@apache.org> wrote:
>>>       
>>>> Please consider the consequences of two different classes w/ the same
>>>>         
>> stream
>>     
>>>> identifier.
>>>>
>>>> Dennis Byrne
>>>>
>>>> On 10/19/07, simon <si...@chello.at> wrote:
>>>>         
>>>>> Why would that make any difference? The classes are in two different
>>>>> packages....
>>>>>
>>>>> On Fri, 2007-10-19 at 14:29 -0500, Dennis Byrne wrote:
>>>>>           
>>>>>> (not sure if this issue has been covered yet in this thread)
>>>>>>
>>>>>> Because these classes are in shared, they will be "split" into two
>>>>>> classes, one for core and one for tomahawk.  When they are split,
>>>>>>             
>> you
>>     
>>>>>> will have two completely classes in the JVM who have the same serial
>>>>>> id.  I'm not going to say "don't do it", but I do think we can agree
>>>>>> this is not a good idea?
>>>>>>
>>>>>> Dennis Byrne
>>>>>>
>>>>>> On 10/19/07, Simon Kitching <si...@chello.at> wrote:
>>>>>>         Hi All,
>>>>>>
>>>>>>         I'd like to make a trivial commit to add serialVersionUID
>>>>>>         values to two classes in shared that don't yet have them.
>>>>>>             
>> This
>>     
>>>>>>         avoids compile warnings in IDEs that have "warn on missing
>>>>>>         serialVersionUID" set.
>>>>>>
>>>>>>         Adding the serialVersionUID is technically the right thing
>>>>>>             
>> to
>>     
>>>>>>         do, IMO although in practice I agree it isn't terribly
>>>>>>         important for these particular classes.
>>>>>>
>>>>>>         Any objections?
>>>>>>
>>>>>>         Cheers,
>>>>>>
>>>>>>         Simon
>>>>>>
>>>>>>         Index:
>>>>>>             
>> /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
>>     
>>>>> ===================================================================
>>>>>           
>>>>>>         ---
>>>>>>             
>> /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
>>     
>>>>> (revision 586396)
>>>>>           
>>>>>>         +++
>>>>>>             
>> /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
>>     
>>>>> (working copy)
>>>>>           
>>>>>>         @@ -74,6 +74,7 @@
>>>>>>              public static final String SELECT_ITEM_LIST_ATTR =
>>>>>>         RendererUtils.class.getName () + ".LIST";
>>>>>>              public static final String EMPTY_STRING = "";
>>>>>>              public static final Object NOTHING = new Serializable()
>>>>>>             
>> {
>>     
>>>>>>         +        private static final long serialVersionUID =
>>>>>>         -8618356560493578754L;
>>>>>>              };
>>>>>>
>>>>>>              public static final String ACTION_FOR_LIST =
>>>>>>         "org.apache.myfaces.ActionForList";
>>>>>>
>>>>>>
>>>>>>         Index:
>>>>>>             
>> /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/util/servlet/SourceCodeServlet.java
>>     
>>>>> ===================================================================
>>>>>           
>>>>>>         ---
>>>>>>             
>> /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/util/servlet/SourceCodeServlet.java
>>     
>>>>    (revision
>>>>         
>>>>> 586396)
>>>>>           
>>>>>>         +++
>>>>>>             
>> /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/util/servlet/SourceCodeServlet.java
>>     
>>>>    (working
>>>>         
>>>>> copy)
>>>>>           
>>>>>>         @@ -25,6 +25,8 @@
>>>>>>
>>>>>>         public class SourceCodeServlet extends HttpServlet
>>>>>>         {
>>>>>>         +    private static final long serialVersionUID =
>>>>>>         -2233965185519715475L;
>>>>>>         +
>>>>>>              public void doGet(HttpServletRequest req,
>>>>>>         HttpServletResponse res)
>>>>>>                  throws IOException, ServletException
>>>>>>              {
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Dennis Byrne
>>>>>>             
>>>>>           
>>>> --
>>>> Dennis Byrne
>>>>
>>>>         
>>> --
>>>
>>> http://www.irian.at
>>>
>>> Your JSF powerhouse -
>>> JSF Consulting, Development and
>>> Courses in English and German
>>>
>>> Professional Support for Apache MyFaces
>>>
>>>       
>
>
>   


Re: [shared] trivial fix for missing serialVersionUID

Posted by Dennis Byrne <de...@apache.org>.
I've read through my posts here and I think there might be some
miscommunication.

Dennis Byrne

On 10/24/07, Martin Marinschek <ma...@gmail.com> wrote:
>
> Exactly - that's for sure. If it wasn't like that, Eclipse wouldn't
> use 1 as a default version id. If it was like Dennis suggested, every
> app built with Eclipse would go kaboom.
>
> ;)
>
> regards,
>
> Martin
>
> On 10/24/07, Mike Kienenberger <mk...@gmail.com> wrote:
> > Yes, wouldn't that have to be the case?   Otherwise, A.jar and B.jar,
> > created by two independent groups, might use the same version id
> > without realizing it, and thus break a project depending on both of
> > them.
> >
> >
> > On 10/24/07, Martin Marinschek <ma...@gmail.com> wrote:
> > > The stream identifier will take into account the FQCN, and the
> > > version-identifier - so the two classes won't have the same stream
> > > identifier, IMHO.
> > >
> > > regards,
> > >
> > > Martin
> > >
> > > On 10/19/07, Dennis Byrne <de...@apache.org> wrote:
> > > > Please consider the consequences of two different classes w/ the
> same
> > stream
> > > > identifier.
> > > >
> > > > Dennis Byrne
> > > >
> > > > On 10/19/07, simon <si...@chello.at> wrote:
> > > > >
> > > > > Why would that make any difference? The classes are in two
> different
> > > > > packages....
> > > > >
> > > > > On Fri, 2007-10-19 at 14:29 -0500, Dennis Byrne wrote:
> > > > > > (not sure if this issue has been covered yet in this thread)
> > > > > >
> > > > > > Because these classes are in shared, they will be "split" into
> two
> > > > > > classes, one for core and one for tomahawk.  When they are
> split,
> > you
> > > > > > will have two completely classes in the JVM who have the same
> serial
> > > > > > id.  I'm not going to say "don't do it", but I do think we can
> agree
> > > > > > this is not a good idea?
> > > > > >
> > > > > > Dennis Byrne
> > > > > >
> > > > > > On 10/19/07, Simon Kitching <si...@chello.at> wrote:
> > > > > >         Hi All,
> > > > > >
> > > > > >         I'd like to make a trivial commit to add
> serialVersionUID
> > > > > >         values to two classes in shared that don't yet have
> them.
> > This
> > > > > >         avoids compile warnings in IDEs that have "warn on
> missing
> > > > > >         serialVersionUID" set.
> > > > > >
> > > > > >         Adding the serialVersionUID is technically the right
> thing
> > to
> > > > > >         do, IMO although in practice I agree it isn't terribly
> > > > > >         important for these particular classes.
> > > > > >
> > > > > >         Any objections?
> > > > > >
> > > > > >         Cheers,
> > > > > >
> > > > > >         Simon
> > > > > >
> > > > > >         Index:
> > > > >
> > > >
> >
> /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
> > > > > >
> > > > >
> ===================================================================
> > > > > >         ---
> > > > >
> > > >
> >
> /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
> > > > > (revision 586396)
> > > > > >         +++
> > > > >
> > > >
> >
> /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
> > > > > (working copy)
> > > > > >         @@ -74,6 +74,7 @@
> > > > > >              public static final String SELECT_ITEM_LIST_ATTR =
> > > > > >         RendererUtils.class.getName () + ".LIST";
> > > > > >              public static final String EMPTY_STRING = "";
> > > > > >              public static final Object NOTHING = new
> Serializable()
> > {
> > > > > >         +        private static final long serialVersionUID =
> > > > > >         -8618356560493578754L;
> > > > > >              };
> > > > > >
> > > > > >              public static final String ACTION_FOR_LIST =
> > > > > >         "org.apache.myfaces.ActionForList";
> > > > > >
> > > > > >
> > > > > >         Index:
> > > > >
> > > >
> >
> /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/util/servlet/SourceCodeServlet.java
> > > > > >
> > > > >
> ===================================================================
> > > > > >         ---
> > > > >
> > > >
> >
> /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/util/servlet/SourceCodeServlet.java
> > > >    (revision
> > > > > 586396)
> > > > > >         +++
> > > > >
> > > >
> >
> /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/util/servlet/SourceCodeServlet.java
> > > >    (working
> > > > > copy)
> > > > > >         @@ -25,6 +25,8 @@
> > > > > >
> > > > > >         public class SourceCodeServlet extends HttpServlet
> > > > > >         {
> > > > > >         +    private static final long serialVersionUID =
> > > > > >         -2233965185519715475L;
> > > > > >         +
> > > > > >              public void doGet(HttpServletRequest req,
> > > > > >         HttpServletResponse res)
> > > > > >                  throws IOException, ServletException
> > > > > >              {
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > Dennis Byrne
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > Dennis Byrne
> > > >
> > >
> > >
> > > --
> > >
> > > http://www.irian.at
> > >
> > > Your JSF powerhouse -
> > > JSF Consulting, Development and
> > > Courses in English and German
> > >
> > > Professional Support for Apache MyFaces
> > >
> >
>
>
> --
>
> http://www.irian.at
>
> Your JSF powerhouse -
> JSF Consulting, Development and
> Courses in English and German
>
> Professional Support for Apache MyFaces
>



-- 
Dennis Byrne

Re: [shared] trivial fix for missing serialVersionUID

Posted by Martin Marinschek <ma...@gmail.com>.
Exactly - that's for sure. If it wasn't like that, Eclipse wouldn't
use 1 as a default version id. If it was like Dennis suggested, every
app built with Eclipse would go kaboom.

;)

regards,

Martin

On 10/24/07, Mike Kienenberger <mk...@gmail.com> wrote:
> Yes, wouldn't that have to be the case?   Otherwise, A.jar and B.jar,
> created by two independent groups, might use the same version id
> without realizing it, and thus break a project depending on both of
> them.
>
>
> On 10/24/07, Martin Marinschek <ma...@gmail.com> wrote:
> > The stream identifier will take into account the FQCN, and the
> > version-identifier - so the two classes won't have the same stream
> > identifier, IMHO.
> >
> > regards,
> >
> > Martin
> >
> > On 10/19/07, Dennis Byrne <de...@apache.org> wrote:
> > > Please consider the consequences of two different classes w/ the same
> stream
> > > identifier.
> > >
> > > Dennis Byrne
> > >
> > > On 10/19/07, simon <si...@chello.at> wrote:
> > > >
> > > > Why would that make any difference? The classes are in two different
> > > > packages....
> > > >
> > > > On Fri, 2007-10-19 at 14:29 -0500, Dennis Byrne wrote:
> > > > > (not sure if this issue has been covered yet in this thread)
> > > > >
> > > > > Because these classes are in shared, they will be "split" into two
> > > > > classes, one for core and one for tomahawk.  When they are split,
> you
> > > > > will have two completely classes in the JVM who have the same serial
> > > > > id.  I'm not going to say "don't do it", but I do think we can agree
> > > > > this is not a good idea?
> > > > >
> > > > > Dennis Byrne
> > > > >
> > > > > On 10/19/07, Simon Kitching <si...@chello.at> wrote:
> > > > >         Hi All,
> > > > >
> > > > >         I'd like to make a trivial commit to add serialVersionUID
> > > > >         values to two classes in shared that don't yet have them.
> This
> > > > >         avoids compile warnings in IDEs that have "warn on missing
> > > > >         serialVersionUID" set.
> > > > >
> > > > >         Adding the serialVersionUID is technically the right thing
> to
> > > > >         do, IMO although in practice I agree it isn't terribly
> > > > >         important for these particular classes.
> > > > >
> > > > >         Any objections?
> > > > >
> > > > >         Cheers,
> > > > >
> > > > >         Simon
> > > > >
> > > > >         Index:
> > > >
> > >
> /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
> > > > >
> > > > ===================================================================
> > > > >         ---
> > > >
> > >
> /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
> > > > (revision 586396)
> > > > >         +++
> > > >
> > >
> /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
> > > > (working copy)
> > > > >         @@ -74,6 +74,7 @@
> > > > >              public static final String SELECT_ITEM_LIST_ATTR =
> > > > >         RendererUtils.class.getName () + ".LIST";
> > > > >              public static final String EMPTY_STRING = "";
> > > > >              public static final Object NOTHING = new Serializable()
> {
> > > > >         +        private static final long serialVersionUID =
> > > > >         -8618356560493578754L;
> > > > >              };
> > > > >
> > > > >              public static final String ACTION_FOR_LIST =
> > > > >         "org.apache.myfaces.ActionForList";
> > > > >
> > > > >
> > > > >         Index:
> > > >
> > >
> /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/util/servlet/SourceCodeServlet.java
> > > > >
> > > > ===================================================================
> > > > >         ---
> > > >
> > >
> /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/util/servlet/SourceCodeServlet.java
> > >    (revision
> > > > 586396)
> > > > >         +++
> > > >
> > >
> /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/util/servlet/SourceCodeServlet.java
> > >    (working
> > > > copy)
> > > > >         @@ -25,6 +25,8 @@
> > > > >
> > > > >         public class SourceCodeServlet extends HttpServlet
> > > > >         {
> > > > >         +    private static final long serialVersionUID =
> > > > >         -2233965185519715475L;
> > > > >         +
> > > > >              public void doGet(HttpServletRequest req,
> > > > >         HttpServletResponse res)
> > > > >                  throws IOException, ServletException
> > > > >              {
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Dennis Byrne
> > > >
> > > >
> > >
> > >
> > > --
> > > Dennis Byrne
> > >
> >
> >
> > --
> >
> > http://www.irian.at
> >
> > Your JSF powerhouse -
> > JSF Consulting, Development and
> > Courses in English and German
> >
> > Professional Support for Apache MyFaces
> >
>


-- 

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Re: [shared] trivial fix for missing serialVersionUID

Posted by Mike Kienenberger <mk...@gmail.com>.
Yes, wouldn't that have to be the case?   Otherwise, A.jar and B.jar,
created by two independent groups, might use the same version id
without realizing it, and thus break a project depending on both of
them.


On 10/24/07, Martin Marinschek <ma...@gmail.com> wrote:
> The stream identifier will take into account the FQCN, and the
> version-identifier - so the two classes won't have the same stream
> identifier, IMHO.
>
> regards,
>
> Martin
>
> On 10/19/07, Dennis Byrne <de...@apache.org> wrote:
> > Please consider the consequences of two different classes w/ the same stream
> > identifier.
> >
> > Dennis Byrne
> >
> > On 10/19/07, simon <si...@chello.at> wrote:
> > >
> > > Why would that make any difference? The classes are in two different
> > > packages....
> > >
> > > On Fri, 2007-10-19 at 14:29 -0500, Dennis Byrne wrote:
> > > > (not sure if this issue has been covered yet in this thread)
> > > >
> > > > Because these classes are in shared, they will be "split" into two
> > > > classes, one for core and one for tomahawk.  When they are split, you
> > > > will have two completely classes in the JVM who have the same serial
> > > > id.  I'm not going to say "don't do it", but I do think we can agree
> > > > this is not a good idea?
> > > >
> > > > Dennis Byrne
> > > >
> > > > On 10/19/07, Simon Kitching <si...@chello.at> wrote:
> > > >         Hi All,
> > > >
> > > >         I'd like to make a trivial commit to add serialVersionUID
> > > >         values to two classes in shared that don't yet have them. This
> > > >         avoids compile warnings in IDEs that have "warn on missing
> > > >         serialVersionUID" set.
> > > >
> > > >         Adding the serialVersionUID is technically the right thing to
> > > >         do, IMO although in practice I agree it isn't terribly
> > > >         important for these particular classes.
> > > >
> > > >         Any objections?
> > > >
> > > >         Cheers,
> > > >
> > > >         Simon
> > > >
> > > >         Index:
> > >
> > /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
> > > >
> > > ===================================================================
> > > >         ---
> > >
> > /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
> > > (revision 586396)
> > > >         +++
> > >
> > /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
> > > (working copy)
> > > >         @@ -74,6 +74,7 @@
> > > >              public static final String SELECT_ITEM_LIST_ATTR =
> > > >         RendererUtils.class.getName () + ".LIST";
> > > >              public static final String EMPTY_STRING = "";
> > > >              public static final Object NOTHING = new Serializable() {
> > > >         +        private static final long serialVersionUID =
> > > >         -8618356560493578754L;
> > > >              };
> > > >
> > > >              public static final String ACTION_FOR_LIST =
> > > >         "org.apache.myfaces.ActionForList";
> > > >
> > > >
> > > >         Index:
> > >
> > /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/util/servlet/SourceCodeServlet.java
> > > >
> > > ===================================================================
> > > >         ---
> > >
> > /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/util/servlet/SourceCodeServlet.java
> >    (revision
> > > 586396)
> > > >         +++
> > >
> > /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/util/servlet/SourceCodeServlet.java
> >    (working
> > > copy)
> > > >         @@ -25,6 +25,8 @@
> > > >
> > > >         public class SourceCodeServlet extends HttpServlet
> > > >         {
> > > >         +    private static final long serialVersionUID =
> > > >         -2233965185519715475L;
> > > >         +
> > > >              public void doGet(HttpServletRequest req,
> > > >         HttpServletResponse res)
> > > >                  throws IOException, ServletException
> > > >              {
> > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Dennis Byrne
> > >
> > >
> >
> >
> > --
> > Dennis Byrne
> >
>
>
> --
>
> http://www.irian.at
>
> Your JSF powerhouse -
> JSF Consulting, Development and
> Courses in English and German
>
> Professional Support for Apache MyFaces
>

Re: [shared] trivial fix for missing serialVersionUID

Posted by Martin Marinschek <ma...@gmail.com>.
The stream identifier will take into account the FQCN, and the
version-identifier - so the two classes won't have the same stream
identifier, IMHO.

regards,

Martin

On 10/19/07, Dennis Byrne <de...@apache.org> wrote:
> Please consider the consequences of two different classes w/ the same stream
> identifier.
>
> Dennis Byrne
>
> On 10/19/07, simon <si...@chello.at> wrote:
> >
> > Why would that make any difference? The classes are in two different
> > packages....
> >
> > On Fri, 2007-10-19 at 14:29 -0500, Dennis Byrne wrote:
> > > (not sure if this issue has been covered yet in this thread)
> > >
> > > Because these classes are in shared, they will be "split" into two
> > > classes, one for core and one for tomahawk.  When they are split, you
> > > will have two completely classes in the JVM who have the same serial
> > > id.  I'm not going to say "don't do it", but I do think we can agree
> > > this is not a good idea?
> > >
> > > Dennis Byrne
> > >
> > > On 10/19/07, Simon Kitching <si...@chello.at> wrote:
> > >         Hi All,
> > >
> > >         I'd like to make a trivial commit to add serialVersionUID
> > >         values to two classes in shared that don't yet have them. This
> > >         avoids compile warnings in IDEs that have "warn on missing
> > >         serialVersionUID" set.
> > >
> > >         Adding the serialVersionUID is technically the right thing to
> > >         do, IMO although in practice I agree it isn't terribly
> > >         important for these particular classes.
> > >
> > >         Any objections?
> > >
> > >         Cheers,
> > >
> > >         Simon
> > >
> > >         Index:
> >
> /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
> > >
> > ===================================================================
> > >         ---
> >
> /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
> > (revision 586396)
> > >         +++
> >
> /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
> > (working copy)
> > >         @@ -74,6 +74,7 @@
> > >              public static final String SELECT_ITEM_LIST_ATTR =
> > >         RendererUtils.class.getName () + ".LIST";
> > >              public static final String EMPTY_STRING = "";
> > >              public static final Object NOTHING = new Serializable() {
> > >         +        private static final long serialVersionUID =
> > >         -8618356560493578754L;
> > >              };
> > >
> > >              public static final String ACTION_FOR_LIST =
> > >         "org.apache.myfaces.ActionForList";
> > >
> > >
> > >         Index:
> >
> /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/util/servlet/SourceCodeServlet.java
> > >
> > ===================================================================
> > >         ---
> >
> /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/util/servlet/SourceCodeServlet.java
>    (revision
> > 586396)
> > >         +++
> >
> /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/util/servlet/SourceCodeServlet.java
>    (working
> > copy)
> > >         @@ -25,6 +25,8 @@
> > >
> > >         public class SourceCodeServlet extends HttpServlet
> > >         {
> > >         +    private static final long serialVersionUID =
> > >         -2233965185519715475L;
> > >         +
> > >              public void doGet(HttpServletRequest req,
> > >         HttpServletResponse res)
> > >                  throws IOException, ServletException
> > >              {
> > >
> > >
> > >
> > >
> > > --
> > > Dennis Byrne
> >
> >
>
>
> --
> Dennis Byrne
>


-- 

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Re: [shared] trivial fix for missing serialVersionUID

Posted by Dennis Byrne <de...@apache.org>.
Please consider the consequences of two different classes w/ the same stream
identifier.

Dennis Byrne

On 10/19/07, simon <si...@chello.at> wrote:
>
> Why would that make any difference? The classes are in two different
> packages....
>
> On Fri, 2007-10-19 at 14:29 -0500, Dennis Byrne wrote:
> > (not sure if this issue has been covered yet in this thread)
> >
> > Because these classes are in shared, they will be "split" into two
> > classes, one for core and one for tomahawk.  When they are split, you
> > will have two completely classes in the JVM who have the same serial
> > id.  I'm not going to say "don't do it", but I do think we can agree
> > this is not a good idea?
> >
> > Dennis Byrne
> >
> > On 10/19/07, Simon Kitching <si...@chello.at> wrote:
> >         Hi All,
> >
> >         I'd like to make a trivial commit to add serialVersionUID
> >         values to two classes in shared that don't yet have them. This
> >         avoids compile warnings in IDEs that have "warn on missing
> >         serialVersionUID" set.
> >
> >         Adding the serialVersionUID is technically the right thing to
> >         do, IMO although in practice I agree it isn't terribly
> >         important for these particular classes.
> >
> >         Any objections?
> >
> >         Cheers,
> >
> >         Simon
> >
> >         Index:
> /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
> >
> ===================================================================
> >         ---
> /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
> (revision 586396)
> >         +++
> /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
> (working copy)
> >         @@ -74,6 +74,7 @@
> >              public static final String SELECT_ITEM_LIST_ATTR =
> >         RendererUtils.class.getName () + ".LIST";
> >              public static final String EMPTY_STRING = "";
> >              public static final Object NOTHING = new Serializable() {
> >         +        private static final long serialVersionUID =
> >         -8618356560493578754L;
> >              };
> >
> >              public static final String ACTION_FOR_LIST =
> >         "org.apache.myfaces.ActionForList";
> >
> >
> >         Index:
> /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/util/servlet/SourceCodeServlet.java
> >
> ===================================================================
> >         ---
> /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/util/servlet/SourceCodeServlet.java    (revision
> 586396)
> >         +++
> /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/util/servlet/SourceCodeServlet.java    (working
> copy)
> >         @@ -25,6 +25,8 @@
> >
> >         public class SourceCodeServlet extends HttpServlet
> >         {
> >         +    private static final long serialVersionUID =
> >         -2233965185519715475L;
> >         +
> >              public void doGet(HttpServletRequest req,
> >         HttpServletResponse res)
> >                  throws IOException, ServletException
> >              {
> >
> >
> >
> >
> > --
> > Dennis Byrne
>
>


-- 
Dennis Byrne

Re: [shared] trivial fix for missing serialVersionUID

Posted by simon <si...@chello.at>.
Why would that make any difference? The classes are in two different
packages....

On Fri, 2007-10-19 at 14:29 -0500, Dennis Byrne wrote:
> (not sure if this issue has been covered yet in this thread)
> 
> Because these classes are in shared, they will be "split" into two
> classes, one for core and one for tomahawk.  When they are split, you
> will have two completely classes in the JVM who have the same serial
> id.  I'm not going to say "don't do it", but I do think we can agree
> this is not a good idea? 
> 
> Dennis Byrne
> 
> On 10/19/07, Simon Kitching <si...@chello.at> wrote:
>         Hi All,
>         
>         I'd like to make a trivial commit to add serialVersionUID
>         values to two classes in shared that don't yet have them. This
>         avoids compile warnings in IDEs that have "warn on missing
>         serialVersionUID" set. 
>         
>         Adding the serialVersionUID is technically the right thing to
>         do, IMO although in practice I agree it isn't terribly
>         important for these particular classes.
>         
>         Any objections?
>         
>         Cheers,
>         
>         Simon
>         
>         Index: /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
>         ===================================================================
>         --- /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java   (revision 586396) 
>         +++ /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java   (working copy)
>         @@ -74,6 +74,7 @@
>              public static final String SELECT_ITEM_LIST_ATTR =
>         RendererUtils.class.getName () + ".LIST";
>              public static final String EMPTY_STRING = "";
>              public static final Object NOTHING = new Serializable() {
>         +        private static final long serialVersionUID =
>         -8618356560493578754L; 
>              };
>         
>              public static final String ACTION_FOR_LIST =
>         "org.apache.myfaces.ActionForList";
>         
>         
>         Index: /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/util/servlet/SourceCodeServlet.java 
>         ===================================================================
>         --- /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/util/servlet/SourceCodeServlet.java    (revision 586396)
>         +++ /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/util/servlet/SourceCodeServlet.java    (working copy)
>         @@ -25,6 +25,8 @@
>         
>         public class SourceCodeServlet extends HttpServlet 
>         {
>         +    private static final long serialVersionUID =
>         -2233965185519715475L;
>         +
>              public void doGet(HttpServletRequest req,
>         HttpServletResponse res)
>                  throws IOException, ServletException
>              { 
>         
> 
> 
> 
> -- 
> Dennis Byrne


Re: [shared] trivial fix for missing serialVersionUID

Posted by Dennis Byrne <de...@apache.org>.
(not sure if this issue has been covered yet in this thread)

Because these classes are in shared, they will be "split" into two classes,
one for core and one for tomahawk.  When they are split, you will have two
completely classes in the JVM who have the same serial id.  I'm not going to
say "don't do it", but I do think we can agree this is not a good idea?

Dennis Byrne

On 10/19/07, Simon Kitching <si...@chello.at> wrote:
>
> Hi All,
>
> I'd like to make a trivial commit to add serialVersionUID values to two
> classes in shared that don't yet have them. This avoids compile warnings in
> IDEs that have "warn on missing serialVersionUID" set.
>
> Adding the serialVersionUID is technically the right thing to do, IMO
> although in practice I agree it isn't terribly important for these
> particular classes.
>
> Any objections?
>
> Cheers,
>
> Simon
>
> Index:
> /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
> ===================================================================
> ---
> /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
> (revision 586396)
> +++
> /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
> (working copy)
> @@ -74,6 +74,7 @@
>      public static final String SELECT_ITEM_LIST_ATTR =
> RendererUtils.class.getName() + ".LIST";
>      public static final String EMPTY_STRING = "";
>      public static final Object NOTHING = new Serializable() {
> +        private static final long serialVersionUID =
> -8618356560493578754L;
>      };
>
>      public static final String ACTION_FOR_LIST = "
> org.apache.myfaces.ActionForList";
>
>
> Index:
> /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/util/servlet/SourceCodeServlet.java
> ===================================================================
> ---
> /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/util/servlet/SourceCodeServlet.java    (revision
> 586396)
> +++
> /home/sk/projects/apache/myfaces/shared/core/src/main/java/org/apache/myfaces/shared/util/servlet/SourceCodeServlet.java    (working
> copy)
> @@ -25,6 +25,8 @@
>
> public class SourceCodeServlet extends HttpServlet
> {
> +    private static final long serialVersionUID = -2233965185519715475L;
> +
>      public void doGet(HttpServletRequest req, HttpServletResponse res)
>          throws IOException, ServletException
>      {
>
>


-- 
Dennis Byrne