| 1 |
// Test case for Issue 1738: |
| 2 |
// https://github.com/typetools/checker-framework/issues/1738 |
| 3 |
|
| 4 |
import java.util.Iterator; |
| 5 |
|
| 6 |
@SuppressWarnings("") // Only check for crashes |
| 7 |
class Issue1738 { |
| 8 |
static class TwoParamIterator<T, R> implements Iterator<T> { |
| 9 |
@Override |
| 10 |
public boolean hasNext() { |
| 11 |
return false; |
| 12 |
} |
| 13 |
|
| 14 |
@Override |
| 15 |
public T next() { |
| 16 |
return null; |
| 17 |
} |
| 18 |
} |
| 19 |
|
| 20 |
static class TwoParamCollection<T, R> implements Iterable<T> { |
| 21 |
@Override |
| 22 |
public TwoParamIterator<T, R> iterator() { |
| 23 |
return new TwoParamIterator<T, R>(); |
| 24 |
} |
| 25 |
} |
| 26 |
|
| 27 |
static void test() { |
| 28 |
TwoParamCollection<String, String> c = new TwoParamCollection<>(); |
| 29 |
for (String s : c) { |
| 30 |
s.hashCode(); |
| 31 |
} |
| 32 |
} |
| 33 |
} |