Hi Paul,

On 02/20/2014 12:49 PM, Paul Benedict wrote:
Joe, I find it interesting that you suppressed the serial warning on an abstract class. I'd like to know more about that. Is this a universal rule? Are serial uids not important for abstract classes?

I wouldn't generalize that way from this example.

The serial hash of NavigableSubMap has differed in different JDK releases, but its subclasses do define serialVersionUID fields. I assume the set of non-transient fields in NavigableSubMap has stayed unchanged, but I haven't verified that.

If I hadn't found the change in the hash value, I would have added the serialVersionUID to NavigableSubMap too.

HTH,

-Joe



On Thu, Feb 20, 2014 at 2:33 PM, Joe Darcy <joe.da...@oracle.com <mailto:joe.da...@oracle.com>> wrote:

    Hello,

    Please review the patch below which will address the handful of
    remaining serial lint warning in the core libraries.

    Thanks,

    -Joe

    diff -r e5a09bc70308 src/share/classes/java/util/EnumSet.java
    --- a/src/share/classes/java/util/EnumSet.java    Thu Feb 20
    13:03:36 2014 +0000
    +++ b/src/share/classes/java/util/EnumSet.java    Thu Feb 20
    12:32:52 2014 -0800
    @@ -80,6 +80,8 @@
     public abstract class EnumSet<E extends Enum<E>> extends
    AbstractSet<E>
         implements Cloneable, java.io.Serializable
     {
    +    private static final long serialVersionUID =
    1009687484059888093L;
    +
         /**
          * The class of all the elements of this set.
          */
    diff -r e5a09bc70308 src/share/classes/java/util/TreeMap.java
    --- a/src/share/classes/java/util/TreeMap.java    Thu Feb 20
    13:03:36 2014 +0000
    +++ b/src/share/classes/java/util/TreeMap.java    Thu Feb 20
    12:32:52 2014 -0800
    @@ -1333,6 +1333,7 @@
         /**
          * @serial include
          */
    +    @SuppressWarnings("serial") // Abstract class
         abstract static class NavigableSubMap<K,V> extends
    AbstractMap<K,V>
             implements NavigableMap<K,V>, java.io.Serializable {
             /**
    diff -r e5a09bc70308
    src/share/classes/sun/reflect/annotation/ExceptionProxy.java
    --- a/src/share/classes/sun/reflect/annotation/ExceptionProxy.java
    Thu Feb 20 13:03:36 2014 +0000
    +++ b/src/share/classes/sun/reflect/annotation/ExceptionProxy.java
    Thu Feb 20 12:33:21 2014 -0800
    @@ -37,5 +37,6 @@
      * @since   1.5
      */
     public abstract class ExceptionProxy implements
    java.io.Serializable {
    +    private static final long serialVersionUID =
    7241930048386631401L;
         protected abstract RuntimeException generateException();
     }




--
Cheers,
Paul

Reply via email to