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 258171

Summary: Use variable latest in scope for code completion
Product: java Reporter: bht <bht>
Component: EditorAssignee: Dusan Balek <dbalek>
Status: NEW ---    
Severity: normal CC: markiewb
Priority: P2    
Version: 8.1   
Hardware: PC   
OS: Windows 7   
Issue Type: ENHANCEMENT Exception Reporter:

Description bht 2016-02-27 21:05:21 UTC
The following code was written by using NetBeans refactoring, code completion of a "for Object" loop.

At the place after typing entityManager.persist I let the IDE complete again.

I would expect that the IDE inserts "customer" as the last Object in scope not "this".

I see this quite often and I get the feeling that there is a potential for improvement here.


public void saveCustomers(List<Customer> customers) {
	for (Customer customer : customers) {
		entityManager.persist(this);// should be customers
	}
}