| 1 |
// Test case for Issue 1920: |
| 2 |
// https://github.com/typetools/checker-framework/issues/1920 |
| 3 |
|
| 4 |
import java.util.Iterator; |
| 5 |
import java.util.NoSuchElementException; |
| 6 |
|
| 7 |
@SuppressWarnings("") // Only check for crashes |
| 8 |
class Issue1920 { |
| 9 |
static class Foo implements Iterable { |
| 10 |
public Iterator iterator() { |
| 11 |
return new Iterator() { |
| 12 |
@Override |
| 13 |
public boolean hasNext() { |
| 14 |
return false; |
| 15 |
} |
| 16 |
|
| 17 |
@Override |
| 18 |
public Object next() { |
| 19 |
throw new NoSuchElementException(); |
| 20 |
} |
| 21 |
}; |
| 22 |
} |
| 23 |
} |
| 24 |
|
| 25 |
static void testErasedIterator(Foo foo) { |
| 26 |
for (Object x : foo) { |
| 27 |
x.hashCode(); |
| 28 |
} |
| 29 |
} |
| 30 |
} |