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

Bug 159551

Summary: [move static members] failure case for "move" refactoring, concerns moving static members
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.3   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug

Description Alex CLA 2006-10-03 04:34:21 EDT
I have discovered a case in which the "move" refactoring will incorrectly refactor code (i.e. invalid java code is generated even when starting with valid java code).

The case occurs when moving two or more private static members which are locally referenced to a different class in a different package. A failure case is:

package bar;
public class Bar {
   private static void static1() {
   }
   private static void static2() {
   }
   public void notstatic() {
      static1();
      static2();
   }
}

Now move both static1 and static2 to a class Foo in package foo, which exists but is empty. The following code will be generated (note the two "public" tokens):

package foo;
public class Foo {
   public static void static1() {
   }
   public public static void static2() {
   }
}

This *is* the smallest case that will cause the failure. A single refactoring will *not* cause the problem, and in the absence of the Bar.nonstatic() function, or in the absence of the calls to statc1 and static2 within nonstatic() the failure will *not* arise. If Foo is in the same package as Bar then the failure will *not* arise.

Hope this helps!
-Alex
Comment 1 Eclipse Genie CLA 2020-01-17 05:24:41 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.