Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8227731

Serial spec should be updated to reflect API generification

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P3 P3
    • 13
    • core-libs
    • minimal
    • The API signatures are corrected to match the API in the javadoc.
    • Java API, Other
    • SE

      Serialization specification corrections to match method signatures.

      The Serialization specification is updated to reflect changes made to the method signatures in previous JDK releases. For example, references to raw classes are updated to include generic signatures.

      Problem

      The API signatures in the Serialization specification are out of date, they were not updated when the API was changed.

      Solution

      Update the signatures to include missing methods, missing 'abstract' keyword, a void return type, and to remove 'synchronized'.

      Specification

      The API signatures listed in the Java Object Serialization Specification are updated for the classes as shown below. (The APIs in the javadoc -- the Java SE API specification -- are not changed.)

      Class java.io.ObjectStreamClass:

       package java.io;
      
      -public class ObjectStreamClass
      +public class ObjectStreamClass implements Serializable
       {
      -    public static ObjectStreamClass lookup(Class cl);
      +    public static ObjectStreamClass lookup(Class<?> cl);
      
      -    public static ObjectStreamClass lookupAny(Class cl);
      +    public static ObjectStreamClass lookupAny(Class<?> cl);
      
           public String getName();
      
      -    public Class forClass();
      +    public Class<?> forClass();
      
           public ObjectStreamField[] getFields();
      +    
      +    public ObjectStreamField getField(String name);

      Class java.io.ObjectStreamField:

       package java.io;
      
      -public class ObjectStreamField implements Comparable {
      +public class ObjectStreamField implements Comparable<Object> {
      
           public ObjectStreamField(String fieldName,
      -                             Class fieldType);
      +                             Class<?> fieldType);
      
           public ObjectStreamField(String fieldName,
      -                             Class fieldType,
      +                             Class<?> fieldType,
                                    boolean unshared);
      
      -    public Class getType();
      +    public Class<?> getType();

      ObjectInputStream:

      -    public synchronized void registerValidation(
      +    public void registerValidation(
               ObjectInputValidation obj, int prio)
               throws NotActiveException, InvalidObjectException;
      
      -    protected Class resolveClass(ObjectStreamClass v)
      +    protected Class<?> resolveClass(ObjectStreamClass v)
               throws IOException, ClassNotFoundException;
      
      +    protected Class<?> resolveProxyClass(String[] interfaces)
      +            throws IOException, ClassNotFoundException;
      +            

      ObjectInputStream.GetField:

           // Class to provide access to serializable fields.
      -    static abstract public class GetField
      +    public abstract static class GetField
           {
      -        public ObjectStreamClass getObjectStreamClass();
      +        public abstract ObjectStreamClass getObjectStreamClass();
      
      -        public boolean defaulted(String name)
      +        public abstract boolean defaulted(String name)
                   throws IOException, IllegalArgumentException;
      
      -        public char get(String name, char default)
      +        public abstract char get(String name, char default)
                   throws IOException, IllegalArgumentException;
      
      -        public boolean get(String name, boolean default)
      +        public abstract boolean get(String name, boolean default)
                   throws IOException, IllegalArgumentException;
      
      -        public byte get(String name, byte default)
      +        public abstract byte get(String name, byte default)
                   throws IOException, IllegalArgumentException;
      
      -        public short get(String name, short default)
      +        public abstract short get(String name, short default)
                   throws IOException, IllegalArgumentException;
      
      -        public int get(String name, int default)
      +        public abstract int get(String name, int default)
                   throws IOException, IllegalArgumentException;
      
      -        public long get(String name, long default)
      +        public abstract long get(String name, long default)
                   throws IOException, IllegalArgumentException;
      
      -        public float get(String name, float default)
      +        public abstract float get(String name, float default)
                   throws IOException, IllegalArgumentException;
      
      -        public double get(String name, double default)
      +        public abstract double get(String name, double default)
                   throws IOException, IllegalArgumentException;
      
      -        public Object get(String name, Object default)
      +        public abstract Object get(String name, Object default)
                   throws IOException, IllegalArgumentException;
           }

      Class java.io.ObjectOutputStream:

      -    public writeFields()
      +    public void writeFields()
               throws IOException;
      
      -    protected void annotateClass(Class cl) throws IOException;
      +    protected void annotateClass(Class<?> cl) throws IOException;
      +
      +    protected void annotateProxyClass(Class<?> cl) throws IOException;

      Class ObjectOutputStream.PutField:

           // Inner class to provide access to serializable fields.
      -    abstract static public class PutField
      +    public abstract static class PutField
           {
               public void put(String name, boolean value)
      -            throws IOException, IllegalArgumentException;
      +            throws IllegalArgumentException;
      
               public void put(String name, char data)
      -            throws IOException, IllegalArgumentException;
      +            throws IllegalArgumentException;
      
               public void put(String name, byte data)
      -            throws IOException, IllegalArgumentException;
      +            throws IllegalArgumentException;
      
               public void put(String name, short data)
      -            throws IOException, IllegalArgumentException;
      +            throws IllegalArgumentException;
      
               public void put(String name, int data)
      -            throws IOException, IllegalArgumentException;
      +            throws IllegalArgumentException;
      
               public void put(String name, long data)
      -            throws IOException, IllegalArgumentException;
      +            throws IllegalArgumentException;
      
               public void put(String name, float data)
      -            throws IOException, IllegalArgumentException;
      +            throws IllegalArgumentException;
      
               public void put(String name, double data)
      -            throws IOException, IllegalArgumentException;
      +            throws IllegalArgumentException;
      
               public void put(String name, Object data)
      -            throws IOException, IllegalArgumentException;
      +            throws IllegalArgumentException;
           }

            rriggs Roger Riggs
            darcy Joe Darcy
            Stuart Marks
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: