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 234348 - alt+F7 doesn't know that java.lang.Iterable#iterator() is used by for-each loops
Summary: alt+F7 doesn't know that java.lang.Iterable#iterator() is used by for-each loops
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 7.3
Hardware: All All
: P3 normal with 1 vote (vote)
Assignee: Ralph Ruijs
URL:
Keywords:
: 249506 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-08-13 19:57 UTC by Leos.Bitto
Modified: 2015-01-05 12:23 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 Leos.Bitto 2013-08-13 19:57:25 UTC
When I have a class which implements java.lang.Iterable and I search for usages (alt+F7) of its method iterator(), no place with the appropriate for-each loop is found.
Comment 1 Jiri Prox 2013-08-19 08:38:07 UTC
Can you, please, provide the sample of code where is this bug visible? Thanks
Comment 2 Leos.Bitto 2013-08-19 10:26:13 UTC
public class NetbeansBug234348 implements Iterable {

    public java.util.Iterator iterator() {
        return new java.util.Iterator() {
            public boolean hasNext() {
                return false;
            }
            public Object next() {
                throw new java.util.NoSuchElementException();
            }
            public void remove() {
                throw new UnsupportedOperationException();
            }
        };
    }
    
    public static void main(String[] args) {
        int i=0;
        for (Object o : new NetbeansBug234348()) { i++; }
        System.out.println("size: "+i);
    }
}
Comment 3 Ralph Ruijs 2015-01-05 12:23:34 UTC
*** Bug 249506 has been marked as a duplicate of this bug. ***