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

Bug 142882

Summary: [move member type] possible inconsistency [refactoring]
Product: [Eclipse Project] JDT Reporter: Alex <alex-eclipsebugs>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3    
Version: 3.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug

Description Alex CLA 2006-05-20 02:20:18 EDT
There is a case which will cause the "Move Member Type to New File" refactoring to make inconsistent code changes. This occurs when two classes in the same namespace contain a sub-type with the same name and there is a reference in one class to the sub-type from the other class. Example:

Foo.java:
class Foo {
  class Inner {
  }
}

Bar.java:
class Bar {
  class Inner {
  }
  Foo.Inner someFunction() {
    return new Foo.Inner();
  }
}


Executing the "Move Member Type to New File" on Foo.Inner causes the return type for someFunction() to be changed to just "Inner" which then refers to Bar.Inner. Ie the code will look like this after the refactoring:

Foo.java:
class Foo {
}

Inner.java:
class Inner {
}

Bar.java:
class Bar {
  class Inner {
  }
  Inner someFunction() {
    return new Inner();
  }
}

This is clearly a problem because someFunction() now returns a completely different type.
Comment 1 Jerome Lanneluc CLA 2006-05-20 03:18:07 EDT
Moving to JDT UI
Comment 2 Eclipse Genie CLA 2020-03-23 16:54:53 EDT
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.