bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/53172] New: Collections.emptyIterator doesn't throw expec


From: sewe at st dot informatik.tu-darmstadt.de
Subject: [Bug classpath/53172] New: Collections.emptyIterator doesn't throw expected exceptions on next()/remove()
Date: Mon, 30 Apr 2012 18:11:06 +0000

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53172

             Bug #: 53172
           Summary: Collections.emptyIterator doesn't throw expected
                    exceptions on next()/remove()
    Classification: Unclassified
           Product: classpath
           Version: unspecified
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: classpath
        AssignedTo: address@hidden
        ReportedBy: address@hidden


In the 0.99 release the implementation of Collections.EmptyIterator looks like
this:

  private static final class EmptyIterator<T> implements Iterator<T> {
    public boolean hasNext() {
      return false;
    }

    public T next() {
      return null;
    }

    public void remove() {}
  }

Alas, according to the OpenJDK JavaDoc, next() and remove() should throw
exceptions: NoSuchElementException and IllegalStateException, respectively
<http://docs.oracle.com/javase/7/docs/api/java/util/Collections.html#emptyIterator%28%29>.

That being said, I can't, for the life of me, find the respective code in the
Git respository
<http://git.savannah.gnu.org/cgit/classpath.git/tree/java/util/Collections.java>,
so maybe this issue is moot.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]