Let’s consider the following code:
public class MyPanel extends JPanel {
private long secretInfo = ...
}
JPanel is Serializable. However, MyPanel should not be Serializable ever, because it contains sensitive information.
How to cleanly cancel/prevent the inherited Serializable aspect from JPanel?
You can use one of the following approaches:
or