Priority
Normal
Type
Bug 
State
Fixed 
Assignee
Dmitry Jemerov 
Subsystem
Refactoring 
Affected versions
Fixed in
Fixed in build
Next build 
Build
7656
Fixed in build
8576
Severity
0
  • Submitted by   Bas Leijdekkers
    2 years ago (22 Jan 2008 18:03)
  • Updated by   root
    3 weeks ago (17 Jan 2010 19:57)
  • Jira: IDEA-42591
    (history, comments)

IDEA-42591

Pull up static members can break code

0
Pulling up static members does not update references qualified with the class name correctly, which can break the code. Example:
public class X {}
public class Y extends X {
	
	private static int x = 0;

	public static int getX() {
		return x;
	}

	public static void setX(int x) {
		Y.x = x;
	}
}

Pulling up all (static) members produces:
public class X {

	private static int x = 0;


	public static int getX() {
		return x;
	}

	public static void setX(int x) {
		Y.x = x;  // does not compile, should be X.x = x;
	}
}
class Y extends X {}

This does not compile. To make matters worse the uncompilable code is green in the editor, see IDEA-16937. This issue may also be related to IDEABKL-4822

Issue was resolved
Comments (0)
 
History (1)
 
Links
 
Issue has no comments