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

Bug 483606

Summary: "Push down" refactor bugs
Product: [Eclipse Project] JDT Reporter: Zorzella Mising name <zorzella>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3    
Version: 4.5.1   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: stalebug

Description Zorzella Mising name CLA 2015-12-03 13:03:50 EST
Using the code snippet below, choose to "refactor > push down" the "foo" method. Observe two bugs:

1. it also gets erroneously added to the "PushDownBug" class, which does not extend "Parent".

2. it should have been added to the anonymous "Parent" class created in the "bar" method, but it's not. In fact, if bar created a "new Parent();" (no anonymous class), that should _also_ be transformed in an anonymous class, and the "foo" method added to it, in order for it to be a true refactor (i.e. no change in behavior).

*********************

package pushdown;

public class PushDownBug {
  
  private static class Parent {
    // This is the method to "push down"
    protected void foo() {}
  }
  
  private static class NamedChild extends Parent {
    
  }
  
  void bar() {
    new Parent() {};
  }
}
Comment 1 Eclipse Genie CLA 2019-12-23 16:23:57 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.