This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 99319 - [encapsulate field] Encapsulate a static final field referenced in another class using import yields compilation error
Summary: [encapsulate field] Encapsulate a static final field referenced in another cl...
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Jan Pokorsky
URL:
Keywords:
Depends on:
Blocks: 152192
  Show dependency tree
 
Reported: 2007-03-28 23:22 UTC by kely_garcia
Modified: 2009-09-08 13:33 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kely_garcia 2007-03-28 23:22:33 UTC
Build ID: 200609161800 (Netbeans 6.0 M3)

Encapsulate a static final field x which is referenced in another class using 
an import statement yields NullPointerException and compilation error. 
Steps To Reproduce: Encapsulate field x on the following:

Class A:
package static_in;

public class A {    
    public static final int x= 0;    
}

Class B:
package static_in;

import static static_in.A.x;
public class B {    
	public void m() {
		int y= x;
	}    
}

Yields the following refactored code:
Class A:
public class A {    
    private static final int x= 0;    

    public static int getX() {
        return x;
    }
}
Class B:
package static_in;

import static static_in.A.x;
public class B {    
	public void m() {
		int y= x;
	}    
}
Comment 1 Jan Becicka 2007-04-24 07:37:22 UTC
Not implemented in trunk so far.
Comment 2 Jan Becicka 2007-06-29 10:23:24 UTC
Valid for 5.5. Encapsulate fields not implemented in M10. Planned for beta1. Need to be reevaluated when implemented.
Should be resolved for 6.0
Comment 3 Jiri Prox 2008-04-11 01:48:51 UTC
moving opened issues from TM <= 6.1 to TM=Dev
Comment 4 Max Sauer 2009-09-08 13:33:22 UTC
Wrks OK in 
---
Product Version: NetBeans IDE Dev (Build 200909040632)
Java: 1.6.0_13; Java HotSpot(TM) 64-Bit Server VM 11.3-b02-83
System: Mac OS X version 10.5.7 running on x86_64; MacRoman; en_US (nb)