Bug 208432 - [DataBinding] ObservableList exposes underlying list
Summary: [DataBinding] ObservableList exposes underlying list
Status: REOPENED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.4   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Boris Bokowski CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2007-11-01 11:05 EDT by Boris Bokowski CLA
Modified: 2020-06-25 05:40 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Boris Bokowski CLA 2007-11-01 11:05:21 EDT
From Ed Merks:

> In ObservableList, this doesn't seem quite right because it provides 
> direct access to the underlying wrapped list.
> 
>     public List subList(int fromIndex, int toIndex) {
>      getterCalled();
>      return wrappedList.subList(fromIndex, toIndex);
>     }
Comment 1 Boris Bokowski CLA 2008-02-03 22:32:29 EST
Fixed in HEAD > 20080203. (I chose the simplest possible fix that makes the sublist unmodifiable. Code contributions for a better implementation are welcome!)
Comment 2 Boris Bokowski CLA 2008-02-05 13:43:00 EST
Verified the simple fix by code inspection on Windows XP using I20080205-0010. 

However, I am going to reopen this bug because subList returns an observable list, but does not fire change events as the underlying list is modified.

To get this right would require real work, for which I don't have enough time right now.
Comment 3 Eclipse Webmaster CLA 2019-09-06 15:30:40 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.
Comment 4 Jens Lideström CLA 2020-06-25 05:40:15 EDT
This bug is still valid.

A possible easy fix is to change ObservableList.subList to return a non-observable, unmodifiable list view.

This however breaks backwards (undocumented) behavioural compatibility. To me that seems warranted in this case.