Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 410438

Summary: [ltk] CompositeChange swallows affectedObjects of its children
Product: [Eclipse Project] JDT Reporter: Jan Koehnlein <jan>
Component: UIAssignee: Markus Keller <markus.kell.r>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert
Version: 4.3Keywords: helpwanted
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: stalebug

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.