...
Code Block |
---|
Class MyFrame { private JFrame frame; private byte[] buffer = new byte[16 * 1024 * 1024]; // now decoupled } |
Compliant Solution (finalization)
Wiki Markup |
---|
\[[Bloch 08|AA. Java References#Bloch 08]\] suggests implementing a {{stop()}} method explicitly such that it leaves the class in an unusable state beyond its lifetime. A {{private}} field within the class can signal whether the class is unusable. All the class methods must check this field prior to operating on the class. This is akin to *EX1* discussed in [OBJ32-J. Do not allow partially initialized objects to be accessed]. |
Risk Assessment
Finalizers can have unexpected behavior.
...