| 1 |
package inference.guava; |
| 2 |
|
| 3 |
import java.util.Iterator; |
| 4 |
import java.util.Spliterator; |
| 5 |
import java.util.function.Consumer; |
| 6 |
import java.util.stream.Stream; |
| 7 |
|
| 8 |
@SuppressWarnings("") // Just check for crashes. |
| 9 |
public class Bug6 { |
| 10 |
public static <Q> Iterable<Q> method(final Iterable<Q> iterable) { |
| 11 |
return new Iterable<Q>() { |
| 12 |
@Override |
| 13 |
public Iterator<Q> iterator() { |
| 14 |
throw new RuntimeException(); |
| 15 |
} |
| 16 |
|
| 17 |
@Override |
| 18 |
public void forEach(Consumer<? super Q> action) { |
| 19 |
throw new RuntimeException(); |
| 20 |
} |
| 21 |
|
| 22 |
@Override |
| 23 |
public Spliterator<Q> spliterator() { |
| 24 |
return Stream.generate(() -> iterable).flatMap(Bug6::stream).spliterator(); |
| 25 |
} |
| 26 |
}; |
| 27 |
} |
| 28 |
|
| 29 |
public static <Z> Stream<Z> stream(Iterable<Z> iterable) { |
| 30 |
throw new RuntimeException(); |
| 31 |
} |
| 32 |
} |