The java.io.ObjectOutputStream API specifies that: "Multiple references to a single object are encoded using a reference sharing mechanism so that graphs of objects can be restored to the same shape as when the original was written. "
Let's say that a knowledge session contains one fact. We serialize the knowledge session and the fact into one output stream. Then deserialize the session and the fact. The object references will be different. In my opinion this is a bug.
Attached is a unit test to show this.
Example use case:
This can happen for example if the stateful knowledge session is stored within a HTTP servlet session. The HTTP servlet session can contain other objects that are part of the stateful knowledge session. When the HTTP servlet session is serialized and deserialized the object references will be different and it is for example no longer possible to do session.getFactHandleByIdentity(...).
Please note that this issue might be fixed by fixing