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 189505

Summary: Trouble with Netbeans 6.9.x on different OSes regarding foreach loop, overloading methods and error marked files with no line listed as cause of the error
Product: java Reporter: jak777
Component: EditorAssignee: Dusan Balek <dbalek>
Status: RESOLVED WONTFIX    
Severity: normal    
Priority: P4    
Version: 6.x   
Hardware: Macintosh (x86)   
OS: Mac OS X   
Issue Type: DEFECT Exception Reporter:

Description jak777 2010-08-14 06:35:52 UTC
Have similar problem with Netbeans 6.9 and 6.9.1. With 6.9 it was installed on Mac OS X Snow Leopard (64 bit Intel) with the latest version of java made by Apple (1.6.0_20). With 6.9.1 it was installed on Red Hat Linux (64 bit Intel) also java (1.6.0_20). In both cases, it was using the same code and had the same errors. The first error is "foreach not applicable to expression type", the next refers to the iterator method not existing and a completely unrelated bug will appear noted on some other files with no line flagged. I have gotten it to compile successfully by returning to Netbeans 6.8 on the Red Hat machine and same with the Mac. The code looks like this.

public interface IteratorInterface<T> extends Iterator<T>, Iterable<T> {}

public abstract class IteratorAbstract<T> implements IteratorInterface<T>
{
...
   @Override
   IteratorAbstract<T> iterator()
   {
       return(this);
   }
...
}

public class SomeIterator extends IteratorAbstract<String>
{
...
//ignoring other methods for simplicity they are actually all filled out
//including the constructor.

   public static void main(String args[])
   {
       for (String s : new SomeIterator("a", "b", "c"))
           System.out.println(s);
   }
}

I don't know whether the proposed solutions works for my case as I am not quite sure what it is or how to complete it, but I do know reverting to the old version has worked.
Comment 1 Jaroslav Tulach 2014-11-05 09:30:10 UTC
I don't see a reason this should be an API review.
Comment 2 Martin Balin 2016-07-07 07:16:34 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