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 <[EMAIL PROTECTED]> 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
     {





Reply via email to