On Wed, 8 Nov 2023 14:14:35 GMT, Tagir F. Valeev <tval...@openjdk.org> wrote:

>> I've thought about that, and since we don't use that for the other 
>> parameters (like `initializer`) I don't think it helps changing it here. And 
>> the reason this has little effect is that the code calling the factory 
>> typically controls the components/parameters/return type.
>
> It's still possible to have a situation where PECS signature could be useful, 
> and I don't see any downsides. A user may want to reuse the same static 
> integrator instead of creating several identical lambdas just because the 
> target type is more specific. Sometimes, people complain later, and you'll 
> have to fix this. For example, see that `Stream.generate()` [was fixed 
> separately](https://bugs.openjdk.org/browse/JDK-8132097). So why not doing 
> this from the very beginning?

@amaembo In this case, given that it is intended as Preview, I think it makes 
sense to receive some user feedback on this. Note that Collector has been 
without PECS for Collector.of since 1.8: 
[of](https://docs.oracle.com/javase/8/docs/api/java/util/stream/Collector.html#of-java.util.function.Supplier-java.util.function.BiConsumer-java.util.function.BinaryOperator-java.util.function.Function-java.util.stream.Collector.Characteristics...-)

Right now I don't want to deviate from the Collector-heritage until there's 
more usage feedback, and I'm definitely not ruling out that PECS:ing the 
factories might be worth it.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/16420#discussion_r1386788253

Reply via email to