Bug 566698 - [Databinding] ObservableList#stream() is not considered as access in SideEffectFactory
Summary: [Databinding] ObservableList#stream() is not considered as access in SideEffe...
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.14   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Christoph Laeubrich CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 566696 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-09-05 08:07 EDT by Christoph Laeubrich CLA
Modified: 2020-11-08 07:51 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christoph Laeubrich CLA 2020-09-05 08:07:17 EDT
If one has an IObservableList/WritableList and uses SideEffectFactory then an access to stream() is not recognized as access and thus on changes the side effect does not occur.

Example:
> IObservableList<Object> list = new WritableList<>();
> ISideEffectFactory factory = WidgetSideEffects.createFactory(parent);
> factory.create(() -> list.stream(), stream -> {
>  //will only be called once on init and never again
>}

it seems that simply an override of that method is missing calling getterCalled(), the same apply for the parallelStream()/spliterator() method.
Comment 1 Eclipse Genie CLA 2020-09-05 08:21:41 EDT
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/168855
Comment 2 Christoph Laeubrich CLA 2020-09-08 02:37:31 EDT
*** Bug 566696 has been marked as a duplicate of this bug. ***
Comment 3 Jens Lideström CLA 2020-11-08 07:51:31 EST
This is a status report for my work on this problem.

I started to investigate the details, and I ran into a number of issues that complicate the solution, which made me run out of time. That's why I haven't gotten in contact about this for a while.

Issues:

* Maybe the delegating IObservableCollection-implementations should delegate calls to `stream` (and the other methods) directly to their delegate object?
* There are two more new methods on Collection in Java 8: toArray(IntFunction) and removeIf. Maybe those should be overridden and marked with @TrackedGetter?
* removeIf doesn't work on the observable collections. That is because the returned iterator does not support removal, even when the collection itself is mutable.
* I started to add tests to ObservableCollectionContractTest (and friends). Then I discovered that IObservableList and IObservableSet handles observable-tracker differently.

Nothing about this is unsolvable, it's just a number of annoying complications. I don't know when I will be able to finish this.