/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* The serialized form is the specification of a class' serialization
* state. <p>
*
* It consists of the following information:<p>
*
* <pre>
* 1. Whether class is Serializable or Externalizable.
* 2. Javadoc for serialization methods.
* a. For Serializable, the optional readObject, writeObject,
* readResolve and writeReplace.
* serialData tag describes, in prose, the sequence and type
* of optional data written by writeObject.
* b. For Externalizable, writeExternal and readExternal.
* serialData tag describes, in prose, the sequence and type
* of optional data written by writeExternal.
* 3. Javadoc for serialization data layout.
* a. For Serializable, the name,type and description
* of each Serializable fields.
* b. For Externalizable, data layout is described by 2(b).
* </pre>
*
* @since 1.2
* @author Joe Fialli
* @author Neal Gafter (rewrite but not too proud)
*/
class SerializedForm {
/* List of FieldDocImpl - Serializable fields.
* Singleton list if class defines Serializable fields explicitly.
* Otherwise, list of default serializable fields.
* 0 length list for Externalizable.
*/
/* True if class specifies serializable fields explicitly.
* using special static member, serialPersistentFields.
*/
private boolean definesSerializableFields = false;
/**
* Constructor.
*
* Catalog Serializable fields for Serializable class.
* Catalog serialization methods for Serializable and
* Externalizable classes.
*/
if (cd.isExternalizable()) {
/* look up required public accessible methods,
* writeExternal and readExternal.
*/
}
}
// } else { // isSerializable() //### ???
} else if (cd.isSerializable()) {
/* Define serializable fields with array of ObjectStreamField.
* Each ObjectStreamField should be documented by a
* serialField tag.
*/
definesSerializableFields = true;
//### No modifier filtering applied here.
} else {
/* Calculate default Serializable fields as all
* non-transient, non-static fields.
* Fields should be documented by serial tag.
*/
}
/* Check for optional customized readObject, writeObject,
* readResolve and writeReplace, which can all contain
* the serialData tag. */
}
}
/*
* Check for explicit Serializable fields.
* Check for a private static array of ObjectStreamField with
* name SERIALIZABLE_FIELDS.
*/
/* SERIALIZABLE_FIELDS can be private,
* so must lookup by ClassSymbol, not by ClassDocImpl.
*/
for (Scope.Entry e = def.members().lookup(names.fromString(SERIALIZABLE_FIELDS)); e.scope != null; e = e.next()) {
return f;
}
}
}
return null;
}
/*
* Compute default Serializable fields from all members of ClassSymbol.
*
* Since the fields of ClassDocImpl might not contain private or
* package accessible fields, must walk over all members of ClassSymbol.
*/
ClassDocImpl cd) {
//### No modifier filtering applied here.
//### Add to beginning.
//### Preserve order used by old 'javadoc'.
}
}
}
}
/*
* Catalog Serializable method if it exists in current ClassSymbol.
* Do not look for method in superclasses.
*
* Serialization requires these methods to be non-static.
*
* @param method should be an unqualified Serializable method
* name either READOBJECT, WRITEOBJECT, READRESOLVE
* or WRITEREPLACE.
* @param visibility the visibility flag for the given method.
*/
for (Scope.Entry e = def.members().lookup(names.fromString(methodName)); e.scope != null; e = e.next()) {
/*
* WARNING: not robust if unqualifiedMethodName is overloaded
* method. Signature checking could make more robust.
* READOBJECT takes a single parameter, java.io.ObjectInputStream.
* WRITEOBJECT takes a single parameter, java.io.ObjectOutputStream.
*/
}
}
}
}
/*
* Associate serialField tag fieldName with FieldDocImpl member.
* Note: A serialField tag does not have to map an existing field
* of a class.
*/
ClassSymbol def) {
// Look for a FieldDocImpl that is documented by serialFieldTagImpl.
break;
}
}
}
}
/**
* Return serializable fields in class. <p>
*
* Returns either a list of default fields documented by serial tag comment or
* javadoc comment<p>
* Or Returns a single FieldDocImpl for serialPersistentField. There is a
* serialField tag for each serializable field.<p>
*
* @return an array of FieldDocImpl for representing the visible
* fields in this class.
*/
}
/**
* Return serialization methods in class.
*
* @return an array of MethodDocImpl for serialization methods in this class.
*/
}
/**
* Returns true if Serializable fields are defined explicitly using
* member, serialPersistentFields.
*
* @see #fields()
*/
boolean definesSerializableFields() {
return definesSerializableFields;
}
}