Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 336952 - Memory Improvement: use static default null policy whenever possible
Summary: Memory Improvement: use static default null policy whenever possible
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-11 10:51 EST by David McCann CLA
Modified: 2022-06-09 10:35 EDT (History)
1 user (show)

See Also:


Attachments
Proposed fix. (42.33 KB, patch)
2011-02-11 10:59 EST, David McCann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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