Bug 322700 - [extract local] "Extract to local variable (replace all occurrences)" is too aggressive
Summary: [extract local] "Extract to local variable (replace all occurrences)" is too ...
Status: CLOSED DUPLICATE of bug 27740
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-14 01:22 EDT by Roland Illig CLA
Modified: 2010-08-18 02:55 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Roland Illig CLA 2010-08-14 01:22:06 EDT
Build Identifier: 20100218-1602

When replacing all occurrences of a (syntactically) common subexpression, Eclipse doesn't check whether some of the subexpressions are modified meanwhile in an obvious way.

package de.roland_illig.eclipse.bugs;

public class RefactorCommonExpressions {

  public static void main(String[] args) {
    int i = 1;
    System.out.println(i + 1);
    i++;
    System.out.println(i + 1);
  }
}

When I tell Eclipse to refactor the expression "i + 1", it doesn't notice that i is modified in between. This changes the program output from "2 3" to "2 2".

Reproducible: Always
Comment 1 Srikanth Sankaran CLA 2010-08-14 06:57:47 EDT
Move to JDT/UI for comment.
Comment 2 Dani Megert CLA 2010-08-18 02:55:25 EDT

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