Bug 24931 - inline method - adds unnecessary assignment [refactoring]
Summary: inline method - adds unnecessary assignment [refactoring]
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.0   Edit
Hardware: PC All
: P3 enhancement (vote)
Target Milestone: 2.1 M5   Edit
Assignee: Dirk Baeumer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-10-17 07:49 EDT by Claude Knaus CLA
Modified: 2002-12-23 08:53 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Claude Knaus CLA 2002-10-17 07:49:09 EDT
I-20021016 linux-gtk:

public class Moo {
  void foo(int a) {
    System.out.println(a);
  }
  void goo() {
    int n= 42;
    foo(n);
    int x= 7; // <--
  }
}

1. select foo in goo
2. inline method
3. press next
4. observe that the method invocation 'foo(n);' is replaced by
   'int a= n; System.out.println(a);'

This assignment is unnecessary und will go away if the following
unrelated statement ('int x= 7;') is removed.

I assume this is some sort of conservative strategy to avoid variable name 
clashes.
Comment 1 Claude Knaus CLA 2002-10-17 07:55:29 EDT
changed to enhancement since it's not a bug
Comment 2 Dirk Baeumer CLA 2002-12-23 08:53:27 EST
Fixed in build > I20021218.