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 238045 - [Encapsulate Field] should check if private setter/getter will be accessible
Summary: [Encapsulate Field] should check if private setter/getter will be accessible
Status: RESOLVED WONTFIX
Alias: None
Product: java
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 8.0
Hardware: PC Windows 7
: P4 normal (vote)
Assignee: Ralph Ruijs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-06 12:43 UTC by ssazonov
Modified: 2016-07-07 07:16 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Encapsulate Field dialog (38.19 KB, image/png)
2013-11-06 12:43 UTC, ssazonov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ssazonov 2013-11-06 12:43:47 UTC
Created attachment 141897 [details]
Encapsulate Field dialog

1. Create 2 simple java calsses in same package:

package test;

public class ClassA {
	int f1 = 10;
}

----------------------------

package test;

public class ClassB {
	public void m1(){
		ClassA a = new ClassA();
		a.f1 = 15;
	}
}

2. Open ClassA, right click into its body and from pop-up menu select Refactor > Encapsulate Fields...

3. Set dialog according attached image and press Refactor

>> Without any warning it generetaes incompilable code since field "f1" is not accessible from ClassB

Product Version: NetBeans IDE Dev (Build 201310290001)
Java: 1.7.0_45; Java HotSpot(TM) 64-Bit Server VM 24.45-b08
Runtime: Java(TM) SE Runtime Environment 1.7.0_45-b18
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Comment 1 Martin Balin 2016-07-07 07:16:56 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss