Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 273265 - [DataBinding] ChangeManager doesn't support Cloneable
Summary: [DataBinding] ChangeManager doesn't support Cloneable
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.4.2   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.5 M7   Edit
Assignee: Matthew Hall CLA
QA Contact: Matthew Hall CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-04-22 10:19 EDT by Chris Audley CLA
Modified: 2009-06-01 08:34 EDT (History)
2 users (show)

See Also:


Attachments
Patch (1.62 KB, patch)
2009-04-27 12:51 EDT, Matthew Hall CLA
no flags Details | Diff
Adds a clone method to ChangeManager (1.62 KB, patch)
2009-05-01 16:25 EDT, Chris Audley CLA
bokowski: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Audley CLA 2009-04-22 10:19:50 EDT
Build ID: M20090211-1700

Steps To Reproduce:
Implement a subclass of AbstractObservable with Cloneable support.

More information:
The org.eclipse.core.databinding.observable.ChangeManager class doesn't implement a clone() method, making it impossible to implement a subclass of AbstractObservable with Cloneable support.

If you attempt to clone an instance of ChangeManager, the clone will contain references to the same listenerLists and listenerTypes arrays as the original.  Listeners previously added to the original ChangeManager will receive events from the clone, and attempts to add or remove listeners on the original or its clone will affect both objects.

ChangeManager can support Cloneable by implementing a clone method that resets the array references in the clone.

public void clone() throws CloneNotSupportedException
{
    ChangeManager duplicate = (ChangeManager)super.clone();
    duplicate.listenerLists = null;
    duplicate.listenerTypes = null;
    return duplicate;
}
Comment 1 Matthew Hall CLA 2009-04-22 12:02:38 EDT
Boris, +1?
Comment 2 Boris Bokowski CLA 2009-04-22 13:39:04 EDT
+1 (this is not an API change, right?)
Comment 3 Matthew Hall CLA 2009-04-22 15:43:35 EDT
(In reply to comment #2)
> +1 (this is not an API change, right?)

Correct.  Although I wouldn't put it past API Tooling to flag it anyway :)
Comment 4 Matthew Hall CLA 2009-04-27 12:51:39 EDT
Created attachment 133392 [details]
Patch
Comment 5 Matthew Hall CLA 2009-04-27 12:52:18 EDT
Released to HEAD > 20090427
Comment 6 Matthew Hall CLA 2009-04-27 12:55:11 EDT
Chris, would you download the patch and then attach it yourself to this bug?  This way the IP log will show this contribution came from you.
Comment 7 Chris Audley CLA 2009-05-01 16:25:49 EDT
Created attachment 134113 [details]
Adds a clone method to ChangeManager

Re-attaching the patch file as requested by Matthew Hall
Comment 8 Boris Bokowski CLA 2009-05-01 16:48:08 EDT
Comment on attachment 134113 [details]
Adds a clone method to ChangeManager

thanks!
Comment 9 John Arthorne CLA 2009-06-01 08:34:08 EDT
Removing iplog+ from bug - this indicates an IP contribution in a comment rather than a patch.

http://wiki.eclipse.org/Development_Resources/Automatic_IP_Log