This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
The patch works on an assumption, that a ClassProxy defines layout of instance's attribute values, and that StorableObjects do not alter this layout. StorableClass is inspected for attributes after it is created and the attributes are assigned a serialCode (similar to T_ constants in IOUtils). The serialization code then switches on this tag instead of on instanceof; it also does not need to emit type tags into the serialized stream. EnumImpl is patched to not generate impls for RefEnums, rather to locate/load them using reflection. It also adds to the serialization patch' effect by encoding Enums into integer values. The mapping is recreated at runtime.
Created attachment 4911 [details] Serialization patch for the existing files
Created attachment 4912 [details] Newly introduced file (src/org/netbeans/mdr/storagemodel/AttributeIOHelper.java)
Hi Svata. I reviewed the patch and applied some portions of it. Especially the improvements made to IOUtils (separate methods for all kinds of types). However I found an alternative way of the serialization of enumerations that is more in line with another change I wanted to make (serialization of datatype descriptors) and I also could not apply most of the changes made to get rid of tags when serializing attribute values. The whole idea is good - especially the thing with remembering the "type number" and then using "switch" instead of "instanceof" to decide which serialization to use is cool - I will probably come back to it later and fix the patch, however currently the patch is incorrect (it does not cover the case when attributes of primitive types contain "null" which is possible in MOF especially if the lower multiplicity bound is 0). Currently I just don't have enough energy and time to fix it since it is not of that high priority - I doubt that it will be a significant performance improvement - I admit that this may get a higher priority once I will finish implementation of events and the simple transactions. In the meantime I made some other performance improvements (got rid of another MOFID (immediatePackage) from StorableObject, rewritten all the serialization to use the new specific serialization methods in IOUtils, improved resolving of datatypes)