Bug 76813 - Extract local variable factorize to much code
Summary: Extract local variable factorize to much code
Status: RESOLVED DUPLICATE of bug 27740
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-10-22 10:57 EDT by Luc Bourlier CLA
Modified: 2004-10-25 05:39 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Luc Bourlier CLA 2004-10-22 10:57:51 EDT
Iterator iterator = new ArrayList().iterator();
while (iterator.hasNext()) {
  iterator.next().toString();
}
iterator = new ArrayList().iterator();
while (iterator.hasNext()) {
  iterator.next().toString();
}

. select 'iterator.next' and invoke refactor>extract local variable. The result is :

Iterator iterator = new ArrayList().iterator();
Object next = iterator.next();
while (iterator.hasNext()) {
  next.toString();
}
iterator = new ArrayList().iterator();
while (iterator.hasNext()) {
  next.toString();
}

this is no the equivalent of the original code.

I don't think it's a direct dup of bug 48231 or bug 35788, the problem in those
cases seems to be the lack of blocks.
In this case, refactoring works fine if I have only one loop.
Comment 1 Dirk Baeumer CLA 2004-10-25 05:39:26 EDT

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