Bug 410438 - [ltk] CompositeChange swallows affectedObjects of its children
Summary: [ltk] CompositeChange swallows affectedObjects of its children
Status: CLOSED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.3   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Markus Keller CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2013-06-11 06:07 EDT by Jan Koehnlein CLA
Modified: 2020-02-23 13:07 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 Jan Koehnlein CLA 2013-06-11 06:07:21 EDT
CompositeChange#getAffectedObjects() will return null if *any* of its children returns null. It should rather return the array of all non-null affectedObjects.
Comment 1 Dani Megert CLA 2013-06-11 06:24:44 EDT
Strictly speaking, if one of the children returns 'null', one cannot compute the correct set of affected objects, hence 'null' is the right answer.

Moving to Markus for final comment.
Comment 2 Jan Koehnlein CLA 2013-06-11 07:04:57 EDT
Interesting, because some Change implementations return null (DocumentChange) and others don't (TextFileChange). So these cannot be composed in the same CompositeChange?
Comment 3 Markus Keller CLA 2013-06-11 09:36:09 EDT
(In reply to comment #1)
I agree, the contract of Change#getAffectedObjects() is pretty clear about this.

The Javadoc of the Change class should mention that subclasses should override getAffectedObjects (e.g. at the end of the paragraph "It is important ...").

DocumentChange, ResourceChange, NullChange, etc. should override getAffectedObjects(). In the first two, it should return the modified element (document/resource). In NullChange, it should return new Object[0].
Comment 4 Eclipse Genie CLA 2020-02-23 13:07:55 EST
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. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. 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.

--
The automated Eclipse Genie.