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

Bug 302066

Summary: getBounds() should be changed to return a copy of the figure's bounds. getBoundsByReference() could be introduced to offer direct access
Product: [Tools] GEF Reporter: Alexander Nyßen <any>
Component: GEF-Legacy GEF (MVC)Assignee: gef-inbox <gef-inbox>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: nyssen
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Alexander Nyßen CLA 2010-02-07 11:57:14 EST
Build Identifier: M20090917-0800

Problems that are caused by a side-effect modification of a figure's bounds are often hard to debug. However, I have seen them happen often, because the bounds as being returned by getBounds() were diretly used for calculations without having copied them in advance.

This pitfall could be prevented by changing getBounds() to always return a copy of the bounds, and by introducing a separate method with a more explicit name (e.g. getBoundsByReference()) that could offer direct access to the bounds as this is currently done by getBounds().

Reproducible: Always
Comment 1 Alexander Nyßen CLA 2014-07-17 08:39:35 EDT
While this is a major pitfall of Draw2d, it is probably to great a change to incorporate "under the hood". As such, resolving as WORKFSFORME.