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
writeObject method combined with a readObject method to control exactly which information to store;
- a
writeObject method with no corresponding readObject; writeObject must eventually call ObjectOutputStream.defaultWriteObject;
- a
readObject method with no corresponding writeObject; readObject must eventually call ObjectInputStream.defaultReadObject;
- a
writeReplace method to allow the class to nominate a replacement to be written (but see below);
- a
readResolve method to allow the class to nominate a replacement for the object just read;
- serializable classes implementing the
java.io.Externalizable interface (since Gradle 8.8)
The following Java Object Serialization features are not supported:
serializable classes implementing the java.io.Externalizable interface; objects of such classes are discarded by the configuration cache during serialization and reported as problems; (supported since Gradle 8.8)
- the
serialPersistentFields member to explicitly declare which fields are serializable; the member, if present, is ignored; the configuration cache considers all but transient fields serializable;
- the following methods of
ObjectOutputStream are not supported and will throw UnsupportedOperationException:
reset(), writeFields(), putFields(), writeChars(String), writeBytes(String) and writeUnshared(Any?).
- the following methods of
ObjectInputStream are not supported and will throw UnsupportedOperationException:
readLine(), readFully(ByteArray), readFully(ByteArray, Int, Int), readUnshared(), readFields(), transferTo(OutputStream) and readAllBytes().
- validations registered via
ObjectInputStream.registerValidation are simply ignored;
- the
readObjectNoData method, if present, is never invoked;
- the serialization protocol isn't used when serializing the replacement returned by
writeReplace.
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.Serializableinterfaceand define one of the following combination of methods:
writeObjectmethod combined with areadObjectmethod to control exactly which information to store;writeObjectmethod with no correspondingreadObject;writeObjectmust eventually callObjectOutputStream.defaultWriteObject;readObjectmethod with no correspondingwriteObject;readObjectmust eventually callObjectInputStream.defaultReadObject;writeReplacemethod to allow the class to nominate a replacement to be written (but see below);readResolvemethod to allow the class to nominate a replacement for the object just read;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;serialPersistentFieldsmember to explicitly declare which fields are serializable; the member, if present, is ignored; the configuration cache considers all buttransientfields serializable;ObjectOutputStreamare not supported and will throwUnsupportedOperationException:reset(),writeFields(),putFields(),writeChars(String),writeBytes(String)andwriteUnshared(Any?).ObjectInputStreamare not supported and will throwUnsupportedOperationException:readLine(),readFully(ByteArray),readFully(ByteArray, Int, Int),readUnshared(),readFields(),transferTo(OutputStream)andreadAllBytes().ObjectInputStream.registerValidationare simply ignored;readObjectNoDatamethod, if present, is never invoked;writeReplace.