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

Bug 102872

Summary: [inline] "Inline Local Variable" into inner class fails when value is "this"
Product: [Eclipse Project] JDT Reporter: David Saff <david>
Component: UIAssignee: Markus Keller <markus.kell.r>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: bmiller, Brian.Miller, till_bay
Version: 3.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug

Description David Saff CLA 2005-07-06 11:34:37 EDT
In 3.1.  Code:

public class Foo {
  public void bar() {
    final Foo foo = this;
    new Runnable() {
      public void run() {
        foo.baz();
      }    
    };
  }
  
  private void baz() {
  }
}

Select foo, and Refactor > Inline.  The resulting code:

  public void bar() {
    new Runnable() {
      public void run() {
        this.baz();
      }    
    };
  }

This should be:

  public void bar() {
    new Runnable() {
      public void run() {
        Foo.this.baz();
      }    
    };
  }
Comment 1 Tobias Widmer CLA 2006-04-05 11:02:11 EDT
Moving to new owner
Comment 2 Martin Aeschlimann CLA 2006-11-13 10:37:12 EST
*** Bug 16741 has been marked as a duplicate of this bug. ***
Comment 3 Eclipse Genie CLA 2019-12-05 18:07:00 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.