The problem is that the generator variable is not initialized at the beginning of the constructor. Any method relying that this variable is already set will fail, causing a NullpointerException.
First approach was to initialize the generator variable lazily. That does solve the NullpointerException problem.
But it causes a followup problem: To find the best deserialization of an object Testrecorder reflectively calls constructors. At any time a constructor is called the virtual method is called and if a snapshot is done on it, the generator will jump in, causing a really bad performance.
The problem is that the generator variable is not initialized at the beginning of the constructor. Any method relying that this variable is already set will fail, causing a NullpointerException.
First approach was to initialize the generator variable lazily. That does solve the NullpointerException problem.
But it causes a followup problem: To find the best deserialization of an object Testrecorder reflectively calls constructors. At any time a constructor is called the virtual method is called and if a snapshot is done on it, the generator will jump in, causing a really bad performance.