Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 336952

Summary: Memory Improvement: use static default null policy whenever possible
Product: z_Archived Reporter: David McCann <david.mccann>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: blaise.doughan
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed fix. none

Description David McCann CLA 2011-02-11 10:51:17 EST
Xml Direct/DirectCollection and Composite/CompositeCollection mappings each create a NullPolicy instance in their constructors to act as a default in the event that one is not explicitly set.  We should add two static NullPolicy instances to NullPolicy - two are required as direct performs setNullRepresentedByEmptyNode(true) but composites do not.

We will add a getNullPolicyInternal() method that detects if a NullPolicy has been explicitly set, if so it will be returned - if not the default will be returned.  This new method is required to avoid the static default being changed by the user.  The getNullPolicy method will now lazy load a NullPolicy instance.

We will need to change internal calls to getNullPolicy (that do not modify the policy, but just check settings) to use getNullPolicyInternal.  This will me done in node value classes, mappings, etc.
Comment 1 David McCann CLA 2011-02-11 10:59:35 EST
Created attachment 188785 [details]
Proposed fix.
Comment 2 Eclipse Webmaster CLA 2022-06-09 10:35:50 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink