-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Open
Labels
Description
JavaObjectSerializationCodec allows objects that support the Java Object Serialization protocol to be stored in the configuration cache.
The implementation is currently limited to serializable classes that implement the java.io.Serializable interface
and define one of the following combination of methods:
- a
writeObjectmethod combined with areadObjectmethod to control exactly which information to store; - a
writeObjectmethod with no correspondingreadObject;writeObjectmust eventually callObjectOutputStream.defaultWriteObject; - a
readObjectmethod with no correspondingwriteObject;readObjectmust eventually callObjectInputStream.defaultReadObject; - a
writeReplacemethod to allow the class to nominate a replacement to be written (but see below); - a
readResolvemethod to allow the class to nominate a replacement for the object just read; - serializable classes implementing the
java.io.Externalizableinterface (since Gradle 8.8)
The following Java Object Serialization features are not supported:
serializable classes implementing the(supported since Gradle 8.8)java.io.Externalizableinterface; objects of such classes are discarded by the configuration cache during serialization and reported as problems;- the
serialPersistentFieldsmember to explicitly declare which fields are serializable; the member, if present, is ignored; the configuration cache considers all buttransientfields serializable; - the following methods of
ObjectOutputStreamare not supported and will throwUnsupportedOperationException:reset(),writeFields(),putFields(),writeChars(String),writeBytes(String)andwriteUnshared(Any?).
- the following methods of
ObjectInputStreamare not supported and will throwUnsupportedOperationException:readLine(),readFully(ByteArray),readFully(ByteArray, Int, Int),readUnshared(),readFields(),transferTo(OutputStream)andreadAllBytes().
- validations registered via
ObjectInputStream.registerValidationare simply ignored; - the
readObjectNoDatamethod, if present, is never invoked; - the serialization protocol isn't used when serializing the replacement returned by
writeReplace.
remal