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

Bug 348278

Summary: [push down] Pushing down method leads to compilation error: No enclosing instance of the type T is accessible in scope
Product: [Eclipse Project] JDT Reporter: Gustavo Soares <gsoares>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: deepakazad, srikanth_sankaran
Version: 3.6.1   
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard: stalebug

Description Gustavo Soares CLA 2011-06-03 16:38:29 EDT
Pushing down a method that contains a method call using qualified this may lead
to compilation error: No enclosing instance of the type is accessible in scope 

Steps to Reproduce:
1. Create the classes:
public class A {
  public long m(){
	  return A.this.k();
  }
  public long k( ){
    return 1;
  }
}
public class B extends A{}

2. Apply the push down refactoring to A.m():
public class A {
  public long k( ){
    return 1;
  }
}
public class B extends A{
  public long m(){
	  return A.this.k();
  }
}

3. After the refactoring, there is a compilation error: No enclosing instance
of the type A is accessible in scope

There is a bug in the pull up method as well: bug 195005
Comment 1 Srikanth Sankaran CLA 2011-06-03 22:49:22 EDT
Move to JDT/UI for comment.
Comment 2 Eclipse Genie CLA 2020-02-14 20:31:20 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. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. 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.