| 1 |
// Test case for Issue 2781: |
| 2 |
// https://github.com/typetools/checker-framework/issues/2781 |
| 3 |
|
| 4 |
import java.util.function.Function; |
| 5 |
import java.util.stream.Stream; |
| 6 |
|
| 7 |
class Issue2781 { |
| 8 |
class Wrapper<T> { |
| 9 |
Wrapper(T t) {} |
| 10 |
} |
| 11 |
|
| 12 |
Stream<Wrapper<Function<String, String>>> getStreamOfWrappedFunctions1() { |
| 13 |
// inferred type in new |
| 14 |
return Stream.<Wrapper<Function<String, String>>>of(new Wrapper<>(e -> e)); |
| 15 |
} |
| 16 |
|
| 17 |
Stream<Wrapper<Function<String, String>>> getStreamOfWrappedFunctions2() { |
| 18 |
// explicit type in new |
| 19 |
return Stream.<Wrapper<Function<String, String>>>of( |
| 20 |
new Wrapper<Function<String, String>>(e -> e)); |
| 21 |
} |
| 22 |
} |