Rodrigo B. de Oliveira

Merge pull request #10318 from gradle/bamboo/ie/serializable/ii

Improve instant execution support of Java serialization

Replace `nullOutputStream()` by `NullOutputStream.INSTANCE`

Signed-off-by: Rodrigo B. de Oliveira <rodrigo@gradle.com>

Suppress `unused` warnings from test

Polish `DefaultInstantExecution`

- Prefer expression chain over `if`/`else`

- Avoid intermediate collection allocation

- Compose method for clarity

Let instant execution report include trace of `Serializable` beans

Remove `mainApkListPersistenceDebug` from the list of unsupported tasks

Introduce `BeanStateReader.newBeanWithId(id: Int)`

And dedupe identity registration code.

Move identity preserving combinators to `Codec.kt`

Preserve identity of `Serializable` objects

Preserve identity of `Serializable` objects

Polish `SerializableWriteObjectCodec`

- Make cheaper `parameterCount` comparison first

Polish `SerializableWriteObjectCodec`

- Make cheaper `parameterCount` comparison first

Extract `SerializableWriteReplaceCodec` from `BeanCodec`

Extract `SerializableWriteReplaceCodec` from `BeanCodec`

Polish `BindingsBackedCodec`

- Rename overriden method parameter to match base definition

Polish `BindingsBackedCodec`

- Rename overriden method parameter to match base definition

Polish `BeanCodec`

- Extract `withBeanTrace` so it can be reused in the `Serializable` codecs

- Use slightly cheaper predicate (`parameterCount == 0`)

Polish `BeanCodec`

- Extract `withBeanTrace` so it can be reused in the `Serializable` codecs

- Use slightly cheaper predicate (`parameterCount == 0`)

Turn `EncodingProducer` type alias into an interface

Turn `EncodingProducer` type alias into an interface

Merge pull request #10310 from gradle/bamboo/ie/serializable

Improve instant execution support for `java.io.Serializable` based types

Remove no longer necessary instant execution codecs for `EnumSet` and `EnumMap`

They can be handled via Java serialization now.

Improve instant execution support for Java serialization

Properly handle deserialization of graphs containing a mix of

`java.io.Serializable` beans and plain beans by introducing

`ReadContext.immediateMode`. In immediate mode, reentrant `read` calls

are not suspended for compatibility with the non-suspending semantics

of `ObjectInputStream.readObject`.

The downside of non-suspending semantics is the risk of

`StackOverflowErrors` caused by deep graphs.

Polish `BeanPropertyReader.kt`

Polish `BeanCodecTest`

Polish `Codec.kt`

- Remove unused member

- Specify return types explicitly to avoid platform types

- Reduce accessibility

Introduce `SerializableWriteObjectCodec`

An instant execution serialization codec for objects that support Java

serialization via a custom `writeObject(ObjectOutputStream)` method.

Polish `ClosureCodec`

Prepare `BindingsBackedCodec` to accept multiple encodings for the same binding

Paving the way for `BeanCodec` to be extended to handle

`java.io.Serializable` based types efficiently.

Polish `InstantExecutionClassLoaderCachingIntegrationTest`