Bug 181127 - [extract local] should warn on side-effects
Summary: [extract local] should warn on side-effects
Status: CLOSED DUPLICATE of bug 27740
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.2.1   Edit
Hardware: PC Windows XP
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-04-05 02:42 EDT by moebius2day CLA
Modified: 2010-08-18 02:55 EDT (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 moebius2day CLA 2007-04-05 02:42:17 EDT
When extracting a local variable from a bit of code, the side-effects of that code (such as the presence of the ++ operator) are not taken into account during the refactor process.

When you have a number of statements such as 

rs.getInt(cur_col++);

in a method, and select one to extract a local variable from it, all the instances are replaced with the name of the variable.  This changes the meaning of the code (because the ++ doesn't happen on every statement anymore) and so isn't really a refactor at all.

Please feel free to ask if you want a more concrete example.

Some info from Eclipse's Help->About screen:
Eclipse SDK
Version: 3.2.1
Build id: M20060921-0945
Comment 1 Dani Megert CLA 2010-08-18 02:55:46 EDT

*** This bug has been marked as a duplicate of bug 27740 ***