user833970
user833970

Reputation: 2799

Is there a way to serialize an object in debug mode?

Often I will fix an obscure bug involving very complicated classes. Now I want to build an automated regression test for it. Ideally there would be a way to serialize the class from debug mode, and re-instantiate it in the unit test. For simplicity you can assume the classes are serializable, like a vector of a few thousand specific Integers. Is there a way to do this, or do I need to spend substantial amounts of time reconstructing the class in code?

I am mainly looking for an answer in java/eclipse, but I would be interested in hearing about any IDE with this feature.

Upvotes: 4

Views: 2006

Answers (1)

user833970
user833970

Reputation: 2799

Window > Show View > Display. You can run arbitrary commands at any point in debug mode where a breakpoint is set. If the class is seralizable, it can be serialized from there.

Upvotes: 1

Related Questions