RFR: JDK-8263545: Convert jpackage to use Stream.toList() [v2]
Ian Graves
igraves at openjdk.java.net
Mon Mar 15 18:53:27 UTC 2021
On Mon, 15 Mar 2021 17:29:46 GMT, Alexey Semenyuk <asemenyuk at openjdk.org> wrote:
>> Ian Graves has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Clarifying type argument and shorting a toArray invocation
>
> src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinMsiBundler.java line 200:
>
>> 198: ).map(e -> {
>> 199: e.getValue().setOutputFileName(e.getKey());
>> 200: return (WixFragmentBuilder) e.getValue();
>
> Why this explicit cast is needed here?
The explicit cast is needed because `Stream.toList()` is invariant, but the stream is producing a covariant type (by way of the type inferencer and `Stream.of(..)` accepting two subclasses of `WixFragmentBuilder`). We need to introduce a hint to bring the type back to the invariant form. On second thought I'm going to make this explicit type argument instead so it's clear that the casting isn't part to what the code is otherwise doing.
-------------
PR: https://git.openjdk.java.net/jdk/pull/2997
More information about the core-libs-dev
mailing list