Bug 351383 - The pull up refactoring on methods of inner classes could result in broken code
Summary: The pull up refactoring on methods of inner classes could result in broken code
Status: CLOSED DUPLICATE of bug 195005
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7   Edit
Hardware: PC Linux
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-07 00:15 EDT by Mohsen Vakilian CLA
Modified: 2011-10-18 21:46 EDT (History)
5 users (show)

See Also:


Attachments
The Eclipse project containing the minimal example that demonstrates the bug in the pull up refactoring (2.61 KB, application/zip)
2011-07-07 00:16 EDT, Mohsen Vakilian CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mohsen Vakilian CLA 2011-07-07 00:15:21 EDT
Build Identifier: 20110615-0604

While working on the CodingSpectator <http://codingspectator.cs.illinois.edu/> project, we tried the pull up refactoring on a piece of code whose structure was similar to the one I use below. We expected the refactoring tool to warn us about the erroneous output that it was going to generate.

Reproducible: Always

Steps to Reproduce:
1. Create a Java project that contains a Java file C.java with the following contents.
  abstract class D {
    abstract void m();
    static class D1 { }
  }
  class C {
    void m() { }
    class C1 extends D.D1 {
      void m() {
        C.this.m();
      }
    }
  }
2. Invoke the pull up method refactoring on method m in C1 to D1 in the above piece of code.
3. Eclipse will perform the refactoring but the resulting code will contain the compilation problem "No enclosing instance of the type C is accessible in scope". I think it would be better if the precondition checks prevent or warn the user about performing this refactoring.
Comment 1 Mohsen Vakilian CLA 2011-07-07 00:16:49 EDT
Created attachment 199221 [details]
The Eclipse project containing the minimal example that demonstrates the bug in the pull up refactoring

The attached Java project contains the piece of code I used to explain the bug.
Comment 2 Ayushman Jain CLA 2011-07-07 02:05:13 EDT
Moving to JDT/UI
Comment 3 Deepak Azad CLA 2011-10-18 21:46:17 EDT

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