Name: rmT116609 Date: 05/12/2003 A DESCRIPTION OF THE REQUEST : Java does not allow anonymous classes to be serialized. This is due to the fact that the constructor generated by the compiler for an anonymous class is done so automatically, and a no-argument constructor is not constructed; furthermore, the compiler prevents the developer from defining their own no-argument contructor for the anonymous class. Object serialization requires that a no-argument constructor be defined. JUSTIFICATION : There are many cases where it is desireable to have fields assigned objects using anonymous classes. Correspondingly, it is oven desireable to serialize information (e.g., for network transport or for persistence). Preventing the developer from serializing all anyonmous classes is a severe restriction. EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - The simplest solution is to automatically generate a no-argument constructor for all anonymous classes. ACTUAL - The current behavior prohibits the serialization of all anyonmous classes. (Review ID: 185561) ======================================================================
|