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 - Use variable latest in scope for code completion
Summary: Use variable latest in scope for code completion
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.1
Hardware: PC Windows 7
: P2 normal (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-27 21:05 UTC by bht
Modified: 2016-03-25 13:25 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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
	}
}